Loading repository dataβ¦
Loading repository dataβ¦
NhanPhamThanh-IT / repository
π§ Complete Express.js backend templates with JavaScript & TypeScript implementations. Features user authentication, JWT security, MongoDB integration, and production-ready architecture. Perfect learning resource and starter template for building scalable REST APIs with modern development practices.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A comprehensive collection of Express.js backend templates showcasing modern web development practices with both JavaScript and TypeScript implementations. This repository serves as a complete learning resource and production-ready foundation for building scalable backend applications.
This repository contains two complete Express.js backend implementations:
Both projects demonstrate the same core functionality but showcase different development approaches, allowing you to choose the best fit for your project requirements.
Backend-Express-Tutorial/
βββ π JavaScript/ # JavaScript Implementation
β βββ π server.js # Main server file
β βββ π package.json # Dependencies & scripts
β βββ π config/ # Configuration files
β βββ π controllers/ # Business logic
β βββ π middleware/ # Custom middleware
β βββ π models/ # Database models
β βββ π routes/ # API routes
β βββ π README.md # JavaScript-specific docs
β
βββ π TypeScript/ # TypeScript Implementation
β βββ π tsconfig.json # TypeScript configuration
β βββ π package.json # Dependencies & scripts
β βββ π src/ # Source code
β β βββ π index.ts # Application entry point
β β βββ π server.ts # Express server setup
β β βββ π config/ # Configuration files
β β βββ π controllers/ # Business logic with types
β β βββ π middleware/ # Type-safe middleware
β β βββ π models/ # Mongoose models with types
β β βββ π routes/ # Type-safe routes
β β βββ π types/ # Type definitions
β βββ π README.md # TypeScript-specific docs
β
βββ π LICENSE # MIT License
βββ π .gitignore # Git ignore rules
βββ π README.md # This file
git clone https://github.com/NhanPhamThanh-IT/Backend-Express-Tutorial.git
cd Backend-Express-Tutorial
cd JavaScript
npm install
# Create .env file with your configuration
npm run dev
cd TypeScript
npm install
# Create .env file with your configuration
npm run dev
Create a .env file in your chosen project directory:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/your-database
JWT_SECRET=your-super-secret-jwt-key
CLIENT_URL=http://localhost:3000
NODE_ENV=development
Your server will be running at http://localhost:5000
Both implementations provide the same API endpoints:
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
POST | /api/v1/auth/register | Register new user | { fullName, email, password } |
POST | /api/v1/auth/login | User login | { email, password } |
Register a new user:
curl -X POST http://localhost:5000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"fullName": "John Doe",
"email": "john@example.com",
"password": "securePassword123"
}'
Login user:
curl -X POST http://localhost:5000/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"password": "securePassword123"
}'
| Feature | JavaScript | TypeScript |
|---|---|---|
| Type Safety | Runtime checking | Compile-time checking |
| Development Speed | Faster initial setup | Slower initial setup |
| Maintainability | Good | Excellent |
| IDE Support | Good | Exceptional |
| Learning Curve | Lower | Higher |
| Production Benefits | Good | Better error prevention |
| Team Development | Good | Better with large teams |
Both implementations follow clean architecture principles:
cd JavaScript
npm install --production
npm start
cd TypeScript
npm install
npm run build
npm start
See the API documentation section above for cURL examples.
Create a .http file with:
### Register User
POST http://localhost:5000/api/v1/auth/register
Content-Type: application/json
{
"fullName": "John Doe",
"email": "john@example.com",
"password": "securePassword123"
}
### Login User
POST http://localhost:5000/api/v1/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "securePassword123"
}
We welcome contributions! Here's how you can help:
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)This project is licensed under the MIT License - see the LICENSE file for details.
Nhan Pham Thanh
Special thanks to: