
# Clone and setup
git clone https://github.com/needkg/node-api-template.git
cd node-api-template
npm install
# Configure environment
cp .env.example .env
# Edit .env with your database credentials
# Start development server
npm run dev
- 🔐 JWT Authentication with refresh tokens
- 👥 User Management with role-based access
- 🛡️ Security First - bcrypt, prepared statements, CORS
- 🏗️ Modular Architecture - clean, maintainable code
- 🗄️ MySQL Integration - connection pooling & auto-setup
- 🔄 Hot Reload - fast development with nodemon
| Method |
Endpoint |
Description |
Authentication |
POST |
/auth/register |
Register new user |
❌ |
POST |
/auth/login |
User login |
❌ |
POST |
/auth/refresh |
Refresh access token |
❌ |
POST |
/auth/logout |
User logout |
❌ |
| Method |
Endpoint |
Description |
Authentication |
GET |
/user/me |
Get user profile |
✅ |
PATCH |
/user/me |
Update profile |
✅ |
| Method |
Endpoint |
Description |
Authentication |
GET |
/admin/users |
List all users |
✅ Admin |
POST |
/admin/users/create |
Create user |
✅ Admin |
PATCH |
/admin/users/:uuid |
Update user |
✅ Admin |
| Method |
Endpoint |
Description |
Authentication |
POST |
/setup/first-admin |
Create first administrator |
❌ |
📡 API Endpoints Documentation → (cooming soon)
- ✅ Password Hashing with bcrypt
- ✅ JWT Tokens for stateless authentication
- ✅ SQL Injection Protection with prepared statements
- ✅ Role-based Access Control
- ✅ Secure Cookie Handling
MIT License - see LICENSE file for details.