This project creates a learning of Node.js frontend and backend.
mongodb and chat system using socket
- REST API using MySQL (Sequelize)
- REST API with Caching using node-cache
/project-root
βββ /src
β βββ /config
β β βββ database.js # Sequelize MySQL Connection
β β βββ mongoose.js # MongoDB Mongoose Connection
β βββ /models
β β βββ /sequelize # Sequelize Models (MySQL)
β β β βββ index.js # Sequelize ORM Setup
β β β βββ user.model.js # Example Sequelize Model
β β β βββ order.model.js # Example Sequelize Model
β β βββ /mongoose # Mongoose Models (MongoDB)
β β β βββ index.js # Mongoose Models Import
β β β βββ category.model.js # Example Mongoose Model
β β β βββ product.model.js # Example Mongoose Model
β βββ /enums
β β βββ Status.js # Common Status Enum
β β βββ UserRole.js # Common User Role Enum
β βββ /migrations # Sequelize Migrations
β βββ /seeders # Sequelize Seed Data
β βββ /repositories # Data Access Layer (For Clean Code)
β β βββ user.repository.js # Repository for Sequelize (MySQL)
β β βββ category.repository.js # Repository for Mongoose (MongoDB)
β βββ /services # Business Logic Layer
β β βββ user.service.js # User Service (MySQL)
β β βββ category.service.js # Category Service (MongoDB)
β βββ /controllers # Controllers (Express.js Routes)
β β βββ user.controller.js # Handles Sequelize Models
β β βββ category.controller.js # Handles Mongoose Models
β βββ /routes
β β βββ user.routes.js # Routes for MySQL (Sequelize)
β β βββ category.routes.js # Routes for MongoDB (Mongoose)
β βββ /middlewares # Express.js Middlewares
β βββ /utils # Helper Functions
β βββ app.js # Main Express App
β βββ server.js # Start Server
βββ /tests # Unit & Integration Tests
βββ .env # Environment Variables
βββ package.json # Dependencies
βββ README.md # Project Documentation
Clone the project
git clone https://github.com/raviyatechnical/learn-nodejsGo to the project directory
cd learn-nodejsCopy .env.example to .env
cp .env.example .envInstall dependencies
npm installStart the server for development
npm run devStart the server
npm run start node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"Client: Coming Soon
Server: Node, Express
Database: MongoDB, MySQL (Sequelize)
What did you learn while building this project? What challenges did you face and how did you overcome them?