This RESTful API was designed to provide essential functionalities for a platform where businesses can share their events with community members, allowing members to sign up and optionally make payments to participate in the events.
The technologies used in development include Express.js to handle API routes and business logic, Prisma for database interactions, Firebase Admin for authentication and other Firebase functionalities, Stripe for payment processing, Cloudinary for image manipulation, and Zod for data validation.
With this API, developers can create both a website and a mobile application to provide a user-friendly interface, enabling users to view events, sign up, and make payments securely and efficiently.
Link to the hosted version of the API below.
https://be-events-platfrom.onrender.com/api/v1
Link to the Front-End project below.
https://github.com/gilbertouk/fe-events-platform
To run this project you need the following programs:
- Node: v20.9.0
 - PostgreSQL: 16.2
 
Then follow the steps below:
Note: If you want to log in with an administrator user on the front-end, you can run the npm run seed command on your terminal to add the data to the database and then you must create a user on Firebase through the website with the following email: admin@ mail.com
With this user you will have access to the form to create new events on the website
The hosted version of the website uses this email as admin: admin@mail.com password: 10203040
- Clone this repository
 - Then you need to install the project's dependencies which you can look for in the `package.json` file.
Use your
npmoryarnpackage managers to install dependenciesnpm install
or
yarn install
 - 
This repository uses the environment variables, to run this project you need to create file .env in the root folder of this project, and inside contain the following environment variable below.
# POSTGRESQL CONNECTION URIs - Se more https://www.prisma.io/dataguide/postgresql/short-guides/connection-uris DATABASE_URL="postgresql://postgres:postgres@localhost:5432/events_db?schema=public" ################################### # FIREBASE AUTH ADMIN - Se more https://firebase.google.com/docs/auth/admin PROJECT_ID="XXXXXX" PRIVATE_KEY_ID="XXXXXX" PRIVATE_KEY='"XXXXXX"' CLIENT_EMAIL="XXXXXX" CLIENT_ID="XXXXXX" AUTH_URI="XXXXXX" TOKEN_URI="XXXXXX" AUTH_PROVIDER_X509_CERT_URL="XXXXXX" CLIENT_X509_CERT_URL="XXXXXX" UNIVERSE_DOMAIN="XXXXXX" ################################### # CLOUDINARY KEY - used to host banner images for events created through the frontend, se more https://cloudinary.com/developers # CLOUD_NAME="XXXXX" CLOUDINARY_API_KEY="XXXXXX" CLOUDINARY_API_SECRET="XXXXXXXX" ################################### # STRIPE KEY - used to handle the payments, se more https://docs.stripe.com/ STRIPE_PUBLISHABLE_KEY="XXXXXXX" STRIPE_SECRET_KEY="XXXXXXXXXXX" STRIPE_SUCCESS_URL="http://localhost:5173/checkout?success=true" # Customers will be directed to this URL if the checkout succeeds STRIPE_CANCEL_URL="http://localhost:5173/checkout?canceled=true" # Customers will be directed to this URL if they decide to cancel payment and return to our website STRIPE_SECRET_WEBHOOK="XXXXXXX" # For the payment flow to work correctly, the webhook must be configured through the Stripe CLI or via the dashboard here https://dashboard.stripe.com/test/webhooks, and and must direct requests to our endpoint at /api/v1/stripe/webhook, which will listen to the "checkout.session.completed" events and automatically make a request to our API and complete the purchase order. Se more https://docs.stripe.com/payments/checkout/fulfill-orders?lang=node
 - To create and seed the database, you need to run the script bellow in your terminal.
npx prisma generate npx prisma migrate dev
 - To re-seed the database run the script below in the terminal
npm run setup-db
 - 
Run the following code in the terminal to begin start the server:
npm run dev
 
👤 Gilberto Silva
- Github: @gilbertouk
 - LinkedIn: @gilbertoantonio
 
Give a ⭐️ if this project helped you!