Full-stack web application menggunakan Angular 19, Node.js/Express, dan MongoDB.
- β Angular 19 frontend dengan standalone components
- β Node.js/Express REST API backend
- β MongoDB database
- β Environment configuration untuk development & production
- β CORS enabled
- β Ready untuk production deployment
- Node.js 20.x atau lebih baru
- npm
- MongoDB (local atau remote)
-
Clone repository
git clone <repository-url> cd test-app
-
Setup Backend
cd server npm install cp .env.example .env # Edit .env sesuai konfigurasi MongoDB Anda
-
Setup Frontend
cd .. npm install -
Start MongoDB
# Pastikan MongoDB sudah running sudo systemctl start mongod -
Seed Sample Data
cd server node seed-data.js -
Run Backend
npm start # Backend running at http://localhost:3000 -
Run Frontend (terminal baru)
cd .. npm start # Frontend running at http://localhost:4200
-
Open Browser
http://localhost:4200
π SETUP.md - Panduan lengkap setup development environment
π DEPLOYMENT.md - Dokumentasi lengkap deployment ke VPS π QUICKSTART-DEPLOY.md - Quick start deployment guide
test-app/
βββ src/ # Angular frontend source
β βββ app/
β β βββ pages/
β β β βββ titles/ # Titles page component
β β βββ services/
β β β βββ title.service.ts # API service
β β βββ app.component.* # Root component
β β βββ app.config.ts # App configuration
β β βββ app.routes.ts # Routing configuration
β βββ environments/ # Environment configurations
β βββ environment.ts # Development config
β βββ environment.prod.ts # Production config
β βββ environment.example.ts # Template
β
βββ server/ # Node.js backend
β βββ server.js # Express server
β βββ seed-data.js # Sample data script
β βββ test-connection.js # MongoDB test script
β βββ package.json # Backend dependencies
β βββ .env # Environment variables (not committed)
β βββ .env.example # Environment template
β
βββ scripts/ # Deployment & maintenance scripts
β βββ setup-vps.sh # VPS initial setup
β βββ backup-mongodb.sh # MongoDB backup script
β βββ restore-mongodb.sh # MongoDB restore script
β
βββ deploy.sh # Auto deployment script
βββ ecosystem.config.js # PM2 configuration
βββ nginx.conf.example # Nginx configuration template
β
βββ SETUP.md # Development setup guide
βββ DEPLOYMENT.md # Production deployment guide
βββ QUICKSTART-DEPLOY.md # Quick deployment guide
βββ README.md # This file
PORT=3000
MONGODB_URI=mongodb://localhost:27017
DB_NAME=testdb
COLLECTION_NAME=titles
NODE_ENV=developmentexport const environment = {
production: false,
apiUrl: 'http://localhost:3000/api'
};Base URL: http://localhost:3000/api
| Method | Endpoint | Description |
|---|---|---|
| GET | /titles |
Get all titles |
| POST | /titles |
Create new title |
# Get all titles
curl http://localhost:3000/api/titles
# Create new title
curl -X POST http://localhost:3000/api/titles \
-H "Content-Type: application/json" \
-d '{"title":"New Title"}'# Run backend
cd server && npm start
# Run frontend
npm start
# Build for production
npm run build -- --configuration production# Test MongoDB connection
cd server && node test-connection.js
# Add sample data
cd server && node seed-data.js# Initial VPS setup
bash scripts/setup-vps.sh
# Deploy/Update application
bash deploy.sh
# Backup MongoDB
bash scripts/backup-mongodb.sh
# Restore MongoDB
bash scripts/restore-mongodb.sh backup_file.tar.gz-
Setup VPS (one time)
bash scripts/setup-vps.sh
-
Configure environment
# Backend cd server cp .env.example .env nano .env # Edit with production values # Frontend nano src/environments/environment.prod.ts # Edit apiUrl
-
Deploy
bash deploy.sh
π See QUICKSTART-DEPLOY.md for detailed instructions.
- Angular 19 - Web framework
- TypeScript - Programming language
- RxJS - Reactive programming
- Node.js - Runtime environment
- Express - Web framework
- MongoDB - NoSQL database
- dotenv - Environment configuration
- PM2 - Process manager
- Nginx - Web server & reverse proxy
- Let's Encrypt - SSL/TLS certificates
- Fork the repository
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add some AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
# Check MongoDB status
sudo systemctl status mongod
# Test connection
cd server && node test-connection.js# Development
cd server && npm start
# Production
pm2 status
pm2 logs test-app-api# Clear cache and rebuild
rm -rf node_modules .angular dist
npm install
npm startMake sure backend CORS is configured in server/server.js:
app.use(cors());- π Setup Guide - Development environment setup
- π Deployment Guide - Production deployment
- π Quick Deploy - Quick deployment steps
This project is open source and available under the MIT License.
Marore Bestari Indonesia
- Initial release
- Angular 19 frontend
- Node.js/Express backend
- MongoDB integration
- Environment configuration
- Production deployment ready