This is the main repository for the OTP Bud application, which consists of a backend server and a frontend client. The backend is built with NestJS and Prisma, while the frontend is built with React and Vite.
backend/: Contains the NestJS backend server code.frontend/: Contains the React frontend client code.
- Backend Setup: backend/README.md
- Frontend Setup: frontend/README.md
To run the application in development with Docker, follow these steps:
- Configure Environment Variables: for development, create a
.envfile for the backend and frontend with the necessary environment variables. You can use the provided.env.examplefiles as templates. - Start Services with Docker Compose: Create a
.envfile in the root of the project for running the compose files. Use the following command to start the database and Redis services:This will start PostgreSQL and Redis services. You'll need to run the backend and frontend locally.docker-compose -f dev.docker-compose.yml up -d
- Stop the Services: To stop the running services, use:
docker-compose -f dev.docker-compose.yml down
To build and run the application for production:
- Configure Environment Variables: Create a
.envfile with production values in the root of the project. You can use the provided.env.examplefile as a template. - Build and Run with Docker Compose: Use the following command to build and start the application:
This will build and start both the backend and frontend services, along with a PostgreSQL database.
docker-compose -f prod.docker-compose.yml up --build
- Access the Application: Once the services are up and running, access the frontend at
http://localhost:3000and the backend API athttp://localhost:4000. - To Stop the Services: To stop the running services, use:
docker-compose -f prod.docker-compose.yml down
- Ensure that you have Docker and Docker Compose installed on your machine.
- The
.envfile should not be committed to version control as it contains sensitive information. - You can find a
.env.examplefile in the root of the project to use as a template for your environment variables.
- Create secrets using the
.envfile to store sensitive information like database credentials and JWT secrets. You can create a Kubernetes secret using the following command:
kubectl create secret generic otpbud-env --from-env-file=.env- To deploy the application using Kubernetes, you can apply the Kubernetes manifests while providing the necessary configuration files located in the
k8s/directory. Use the following command:
kubectl apply -f k8s/