✨ This workspace has been generated by Nx, Smart Monorepos · Fast CI. ✨
This project is a full-stack application built with Nx, a powerful tool for creating smart monorepos and enabling fast CI. The backend of the application is developed using Nest, a progressive Node.js framework, while the frontend is built with Next.js, a popular React framework. The database used is Postgres, and TypeORM is utilized as the ORM (Object-Relational Mapping) tool.
This project combines the power of Nx, Nest, Next.js, Postgres, and TypeORM to provide a robust and efficient full-stack development experience.
Install all the dependencies needed for the project.
npm install
For the database either, you can setup everything in your system or you can use docker.
-
Sytem setup: Install Postgresql
-
Docker Setup:
- Install docker
- Create docker image of the database: (Here -d will create and start the containers in the background, allowing you to continue using your terminal for other tasks.)
docker-compose -f docker-compose.dev.yml up -d
After successful installation, you can seed some minimum data to the database to run your app:
npx nx seed:run quick-learn-backend
After successful seeding, you can set the env variable for the apps:
cp apps/quick-learn-backend/.env.example apps/quick-learn-backend/.env.dev
cp apps/quick-learn-frontend/.env.example apps/quick-learn-frontend/.env
update this variables to desired values.
Now, you can run the backend and frontend or you can use the nx to run multiple apps at once.
Start Backend
npx nx run quick-learn-backend:dev
Start Frontend
npx nx run quick-learn-frontend:dev
Or, run both the app at once:
npx nx run-many --target=dev
Or, you can use the predefined script in package.json. This is make the db up and at the same time it will run both the apps.
npm run dev
Note: Before going for hosting, check if the backend app has .env.production and frontend app has .env files.
For hosting, quick-learn is using two ways. you can use whatever that suits you:
- Using Docker
- Using PM2
Build the base image:
docker build . -t quick-learn:nx-base
Building image for both the apps:
docker compose build
Run the apps:
docker compose up -d
Install pm2 globally:
npm install pm2@latest
Create build for both the apps
npm run build:frontend:production
npm run build:backend:production
Now using pm2, run both the apps:
pm start ecosystem.config.js
You can go through this pm2 docs, to monitor the pm2 running apps.
TODO: Add a well docs for using nginx for the reverse proxy.