A real-time chat application built with NestJS, Prisma, Socket.IO, JWT, and Supabase.
- Real-time communication with Socket.IO.
- Authentication and authorization using JWT.
- Database management with Prisma and PostgreSQL (or any supported Prisma database).
- Scalable and maintainable backend architecture.
- Integrated with Supabase for additional functionalities.
Ensure you have the following installed:
- Node.js: >= 16.x
- Yarn or npm
- PostgreSQL or a Prisma-compatible database.
Set up the .env file with the following variables:
DATABASE_URL="your_database_connection_string"
DIRECT_URL="your_direct_database_connection_string"
PORT=3000
JWT_SECRET="your_jwt_secret_key"-
Clone the repository:
git clone git@github.com:Rumazor/chatApp-backend.git cd chat-app -
Install dependencies:
yarn install # or npm install -
Generate Prisma client:
npx prisma generate
-
Run database migrations:
npx prisma migrate dev
-
Pull the database schema (if needed):
npx prisma db pull
yarn start:dev
# or
npm run start:dev-
Build the application:
yarn build # or npm run build -
Start the application:
yarn start:prod # or npm run start:prod
yarn start: Starts the app in production mode.yarn start:dev: Starts the app in development mode with live reload.yarn test: Runs tests using Jest.yarn format: Formats the code using Prettier.yarn lint: Lints the code using ESLint.yarn build: Builds the project for production.
-
Generate Prisma Client:
npx prisma generate
-
Run Migrations:
npx prisma migrate dev
-
Pull Existing Database Schema:
npx prisma db pull
-
View Prisma Studio (GUI for the database):
npx prisma studio
Socket.IO is used for real-time communication. Update the configuration in src/app.gateway.ts for custom namespace or event handling.
Authentication is managed with JWT. Ensure you set the JWT_SECRET in the .env file. Modify the logic in the auth module to suit your requirements.
| Variable | Description |
|---|---|
DATABASE_URL |
Database connection string |
DIRECT_URL |
Direct database URL (optional) |
PORT |
Server port (default: 3000) |
JWT_SECRET |
Secret key for JWT encryption |
- This project uses Supabase for additional backend services. Make sure to configure your Supabase settings in the
.envfile or within the respective modules. - For detailed API documentation, access the Swagger UI at
/api-docsafter running the app.
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit changes:
git commit -m "Add feature description" - Push to the branch:
git push origin feature-name
- Create a pull request.
This project is licensed under the UNLICENSED license.