-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Thant Htoo Aung edited this page Feb 23, 2026
·
1 revision
This guide will help you set up and run the DevCom Social Media API on your local machine.
Before you begin, ensure you have the following installed:
- Node.js (v20.x or higher)
- MongoDB (v7.0 or higher) - or use Docker
- npm or yarn
- Git
git clone https://github.com/your-username/DevCom_Node.git
cd DevCom_Nodenpm installCreate a .env file in the root directory:
cp .env.example .envEdit .env with your configuration:
# Server Configuration
PORT=3000
NODE_ENV=development
# Database
MONGO_URI=mongodb://localhost:27017/devcom
# JWT
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=7d
# Cloudinary (for image uploads - optional)
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100Option A: Using Docker (Recommended)
docker-compose up -d mongodbOption B: Local MongoDB
Make sure MongoDB is running on your system:
# macOS
brew services start mongodb-community
# Linux
sudo systemctl start mongod
# Windows
# Start MongoDB service from Services panelDevelopment Mode:
npm run devThe server will start on http://localhost:3000
Production Mode:
npm run build
npm start- Check the health endpoint:
curl http://localhost:3000/healthExpected response:
{
"success": true,
"message": "Server is running",
"timestamp": "2024-01-01T00:00:00.000Z"
}- Test the API by registering a user:
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com",
"password": "password123"
}'src/
├── app.ts # Express app configuration
├── server.ts # Server entry point
├── config/ # Configuration files
├── modules/ # Feature modules
│ ├── auth/ # Authentication
│ ├── user/ # User management
│ ├── post/ # Posts
│ ├── comment/ # Comments
│ ├── reaction/ # Reactions
│ ├── feed/ # Global feed
│ └── tag/ # Tags
├── common/ # Shared utilities
├── routes/ # Route definitions
└── database/ # Database models
- Read the API Documentation to understand available endpoints
- Check out the Architecture Overview to understand the codebase structure
- Review the Development Guide for contributing guidelines
- Ensure MongoDB is running:
mongosh --eval "db.adminCommand('ping')" - Check your
MONGO_URIin.env - Verify MongoDB is accessible on the specified port
If port 3000 is already in use, change the PORT in your .env file.
Make sure all dependencies are installed:
npm installClear the build directory and rebuild:
rm -rf dist
npm run buildNeed help? Open an issue on GitHub or check the Troubleshooting Guide.