295 lines
6.5 KiB
Markdown
295 lines
6.5 KiB
Markdown
# 🚀 Project Launch Instructions
|
|
|
|
This document provides step-by-step instructions for launching the Enterprise Asset Management System.
|
|
|
|
## Prerequisites
|
|
|
|
- Node.js (v18 or higher)
|
|
- Docker and Docker Compose
|
|
- Git
|
|
|
|
## Quick Start (Recommended)
|
|
|
|
### **Option 1: One-Command Setup**
|
|
```bash
|
|
# Complete setup for new developers
|
|
make quick-start
|
|
|
|
# Then start development servers
|
|
make dev-fe # Frontend (port 3000)
|
|
make dev-api # Node API (port 3001)
|
|
```
|
|
|
|
### **Option 2: Manual Setup**
|
|
```bash
|
|
# 1. Install dependencies
|
|
make install
|
|
|
|
# 2. Start backend services
|
|
make dev
|
|
|
|
# 3. Import database schema
|
|
make schema
|
|
|
|
# 4. Start development servers
|
|
make dev-fe # Frontend (port 3000)
|
|
make dev-api # Node API (port 3001)
|
|
```
|
|
|
|
## Server Commands
|
|
|
|
### **Using Makefile (Recommended)**
|
|
```bash
|
|
# Start Node API development server
|
|
make dev-api
|
|
|
|
# Start frontend development server
|
|
make dev-fe
|
|
|
|
# Start entire development environment
|
|
make dev
|
|
```
|
|
|
|
### **Direct NPM Commands**
|
|
```bash
|
|
# Node API Server
|
|
cd node_api
|
|
npm run dev # Development mode (auto-reload)
|
|
npm start # Production mode
|
|
|
|
# Frontend Server
|
|
cd frontend
|
|
npm run dev # Development mode
|
|
npm run build # Build for production
|
|
```
|
|
|
|
## Complete Development Setup
|
|
|
|
### **Step-by-Step Launch**
|
|
```bash
|
|
# 1. Clone and setup
|
|
git clone <your-repo-url>
|
|
cd enterprise-asset-management
|
|
|
|
# 2. Install dependencies
|
|
make install
|
|
|
|
# 3. Start backend services (PostgreSQL, Directus, Redis)
|
|
make dev
|
|
|
|
# 4. Import database schema and sample data
|
|
make schema
|
|
|
|
# 5. Start Node API server (Terminal 1)
|
|
make dev-api
|
|
|
|
# 6. Start frontend dev server (Terminal 2)
|
|
make dev-fe
|
|
```
|
|
|
|
## Service URLs
|
|
|
|
After successful launch, you can access:
|
|
|
|
- **Frontend Application:** http://localhost:3000
|
|
- **Node API Server:** http://localhost:3001
|
|
- **API Health Check:** http://localhost:3001/health
|
|
- **Directus Admin:** http://localhost:8055/admin
|
|
- **PostgreSQL:** localhost:5432
|
|
|
|
## Default Credentials
|
|
|
|
### **Directus Admin**
|
|
- **URL:** http://localhost:8055/admin
|
|
- **Email:** admin@assetmanagement.com
|
|
- **Password:** AssetAdmin2024!
|
|
|
|
### **Database**
|
|
- **Host:** localhost
|
|
- **Port:** 5432
|
|
- **Database:** asset_management
|
|
- **Username:** postgres
|
|
- **Password:** postgres
|
|
|
|
## Environment Files
|
|
|
|
### **Frontend (.env)**
|
|
```bash
|
|
# Copy example file
|
|
cp frontend/.env.example frontend/.env
|
|
|
|
# Edit with your settings
|
|
VITE_API_URL=http://localhost:3001
|
|
VITE_DIRECTUS_URL=http://localhost:8055
|
|
```
|
|
|
|
### **Node API (.env)**
|
|
```bash
|
|
# Copy example file
|
|
cp node_api/.env.example node_api/.env
|
|
|
|
# Edit with your settings
|
|
PORT=3001
|
|
DB_HOST=localhost
|
|
DB_PORT=5432
|
|
DB_NAME=asset_management
|
|
DB_USER=postgres
|
|
DB_PASSWORD=postgres
|
|
DIRECTUS_URL=http://localhost:8055
|
|
```
|
|
|
|
## Development Workflow
|
|
|
|
### **Daily Development**
|
|
```bash
|
|
# 1. Start backend services
|
|
make dev
|
|
|
|
# 2. Start API server (Terminal 1)
|
|
make dev-api
|
|
|
|
# 3. Start frontend (Terminal 2)
|
|
make dev-fe
|
|
|
|
# 4. Start coding! 🎯
|
|
```
|
|
|
|
### **Stopping Services**
|
|
```bash
|
|
# Stop all Docker services
|
|
make down
|
|
|
|
# Or stop individual processes
|
|
Ctrl+C in terminal windows
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### **Port Conflicts**
|
|
```bash
|
|
# Check what's using ports
|
|
lsof -i :3000 # Frontend
|
|
lsof -i :3001 # Node API
|
|
lsof -i :5432 # PostgreSQL
|
|
lsof -i :8055 # Directus
|
|
|
|
# Kill processes if needed
|
|
kill -9 <PID>
|
|
```
|
|
|
|
### **Database Issues**
|
|
```bash
|
|
# Reset database completely
|
|
make db-reset
|
|
|
|
# Check database connection
|
|
make status
|
|
```
|
|
|
|
### **Clean Start**
|
|
```bash
|
|
# Clean everything and start fresh
|
|
make clean
|
|
make quick-start
|
|
```
|
|
|
|
### **Check Service Status**
|
|
```bash
|
|
# View running containers
|
|
make status
|
|
|
|
# View logs
|
|
make logs
|
|
|
|
# View specific service logs
|
|
docker-compose logs -f postgres
|
|
docker-compose logs -f directus
|
|
```
|
|
|
|
## Architecture Overview
|
|
|
|
```
|
|
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
│ Frontend │ │ Node API │ │ Database │
|
|
│ (Vue.js) │ │ (Express) │ │ (PostgreSQL) │
|
|
│ Port: 3000 │────│ Port: 3001 │────│ Port: 5432 │
|
|
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
│ │
|
|
│ ┌─────────────────┐ │
|
|
└──────────────│ Directus │─────────────┘
|
|
│ (Headless CMS)│
|
|
│ Port: 8055 │
|
|
└─────────────────┘
|
|
```
|
|
|
|
## Available Make Commands
|
|
|
|
Run `make help` to see all available commands:
|
|
|
|
```bash
|
|
make help # Show all available commands
|
|
make install # Install dependencies
|
|
make dev # Start development environment
|
|
make dev-fe # Start frontend server
|
|
make dev-api # Start Node API server
|
|
make schema # Import database schema
|
|
make build # Build for production
|
|
make prod # Start production environment
|
|
make up # Start all Docker services
|
|
make down # Stop all Docker services
|
|
make restart # Restart all services
|
|
make logs # Show service logs
|
|
make clean # Clean up containers and volumes
|
|
make db-reset # Reset database with fresh schema
|
|
make status # Show system status
|
|
make quick-start # Complete setup for new developers
|
|
```
|
|
|
|
## Feature Development
|
|
|
|
### **Creating New Features**
|
|
```bash
|
|
# 1. Create feature branch
|
|
git checkout -b feature/your-feature
|
|
|
|
# 2. Start development servers
|
|
make dev-api
|
|
make dev-fe
|
|
|
|
# 3. Make changes and test
|
|
# Frontend: http://localhost:3000
|
|
# API: http://localhost:3001
|
|
|
|
# 4. Commit and push
|
|
git add .
|
|
git commit -m "Add your feature"
|
|
git push
|
|
```
|
|
|
|
### **Testing Your Changes**
|
|
- **Frontend:** Changes auto-reload at http://localhost:3000
|
|
- **API:** Changes auto-reload at http://localhost:3001
|
|
- **Database:** Access via Directus admin at http://localhost:8055/admin
|
|
|
|
## Production Deployment
|
|
|
|
```bash
|
|
# Build and run production environment
|
|
make prod
|
|
|
|
# Or build frontend only
|
|
make build
|
|
```
|
|
|
|
## Need Help?
|
|
|
|
1. Check `make help` for all available commands
|
|
2. Review `GIT_COMMANDS.md` for Git workflow
|
|
3. Check service logs: `make logs`
|
|
4. Reset everything: `make clean && make quick-start`
|
|
|
|
---
|
|
|
|
**Happy Coding! 🎉**
|
|
|
|
For more detailed information, see the project documentation in the `docs/` directory. |