This project is a modular Express.js backend built with TypeScript, using esbuild for bundling, Mongoose for MongoDB interactions, and WebSocket support for real-time communication.
- Modular architecture
- TypeScript for type safety
- esbuild for fast builds
- JWT-based authentication
- Mongoose for MongoDB interaction
- WebSocket for real-time communication
src
├── controllers
│ └── authController.ts
├── middlewares
│ └── authMiddleware.ts
├── models
│ └── userModel.ts
├── routes
│ └── authRoutes.ts
├── services
│ └── authService.ts
├── utils
│ └── db.ts
├── ws
│ └── websocket.ts
├── index.ts
└── types.ts
- Node.js
- npm or yarn
- MongoDB
-
Clone the repository:
git clone https://github.com/omkar342/Ayna-Chat-Backned cd Ayna-Chat-Backned
-
Install dependencies:
npm install
-
Create a .env file and add your MongoDB connection string and JWT secret:
MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret PORT=your_port
-
Build and run the project:
# For production npm run build npm start
POST /api/auth/register
- Register a new userPOST /api/auth/login
- Login a user