- Created .gitignore to exclude sensitive files and directories. - Added API documentation in API_DOCUMENTATION.md. - Included deployment instructions in DEPLOYMENT.md. - Established project structure documentation in PROJECT_STRUCTURE.md. - Updated README.md with project status and team information. - Added recommendations and status tracking documents. - Introduced testing guidelines in TESTING.md. - Set up CI workflow in .github/workflows/ci.yml. - Created Dockerfile for backend and frontend setups. - Added various service and utility files for backend functionality. - Implemented frontend components and pages for user interface. - Included mobile app structure and services. - Established scripts for deployment across multiple chains.
222 lines
3.8 KiB
Markdown
222 lines
3.8 KiB
Markdown
# ASLE Setup Guide
|
|
|
|
Complete setup instructions for the ASLE platform.
|
|
|
|
## Prerequisites
|
|
|
|
- Node.js 18+ and npm
|
|
- PostgreSQL 14+
|
|
- Redis (optional, for caching)
|
|
- Docker and Docker Compose (optional)
|
|
|
|
## Quick Start
|
|
|
|
### 1. Clone and Install
|
|
|
|
```bash
|
|
# Install backend dependencies
|
|
cd backend
|
|
npm install
|
|
|
|
# Install frontend dependencies
|
|
cd ../frontend
|
|
npm install
|
|
```
|
|
|
|
### 2. Database Setup
|
|
|
|
```bash
|
|
cd backend
|
|
|
|
# Copy environment file
|
|
cp .env.example .env
|
|
|
|
# Edit .env with your database credentials
|
|
# DATABASE_URL="postgresql://user:password@localhost:5432/asle"
|
|
|
|
# Generate Prisma client
|
|
npm run prisma:generate
|
|
|
|
# Run migrations
|
|
npm run prisma:migrate
|
|
|
|
# Initialize database with default configs
|
|
npm run setup:db
|
|
|
|
# Create initial admin user
|
|
npm run setup:admin
|
|
```
|
|
|
|
### 3. Environment Configuration
|
|
|
|
Edit `backend/.env` with your configuration:
|
|
|
|
**Required:**
|
|
- `DATABASE_URL` - PostgreSQL connection string
|
|
- `JWT_SECRET` - Secret key for JWT tokens (use strong random string)
|
|
- `DIAMOND_ADDRESS` - Deployed Diamond contract address
|
|
- `RPC_URL` - Ethereum RPC endpoint
|
|
|
|
**Optional (for push notifications):**
|
|
- `FIREBASE_SERVICE_ACCOUNT` - Firebase service account JSON
|
|
- `ONESIGNAL_APP_ID` and `ONESIGNAL_API_KEY` - OneSignal credentials
|
|
- `AWS_SNS_IOS_ARN` and `AWS_SNS_ANDROID_ARN` - AWS SNS platform ARNs
|
|
- `FCM_SERVER_KEY` - Firebase Cloud Messaging server key
|
|
- `APNS_KEY_ID`, `APNS_TEAM_ID`, `APNS_KEY_PATH` - Apple Push Notification credentials
|
|
|
|
**Optional (for KYC/AML):**
|
|
- Provider API keys (Sumsub, Onfido, Jumio, Veriff, Persona, Chainalysis, Elliptic, CipherTrace, TRM)
|
|
|
|
### 4. Start Services
|
|
|
|
**Backend:**
|
|
```bash
|
|
cd backend
|
|
npm run dev
|
|
```
|
|
|
|
**Frontend:**
|
|
```bash
|
|
cd frontend
|
|
npm run dev
|
|
```
|
|
|
|
### 5. Access Applications
|
|
|
|
- **Frontend:** http://localhost:3000
|
|
- **Backend API:** http://localhost:4000
|
|
- **Admin Dashboard:** http://localhost:3000/admin
|
|
- **User DApp:** http://localhost:3000/dapp
|
|
- **GraphQL Playground:** http://localhost:4000/graphql
|
|
|
|
## Production Deployment
|
|
|
|
### 1. Build
|
|
|
|
```bash
|
|
# Backend
|
|
cd backend
|
|
npm run build
|
|
|
|
# Frontend
|
|
cd ../frontend
|
|
npm run build
|
|
```
|
|
|
|
### 2. Environment Variables
|
|
|
|
Set all environment variables in your production environment. Use a secret management service (AWS Secrets Manager, HashiCorp Vault) for sensitive values.
|
|
|
|
### 3. Database Migration
|
|
|
|
```bash
|
|
cd backend
|
|
npm run prisma:migrate deploy
|
|
```
|
|
|
|
### 4. Run
|
|
|
|
```bash
|
|
# Backend
|
|
cd backend
|
|
npm start
|
|
|
|
# Frontend
|
|
cd frontend
|
|
npm start
|
|
```
|
|
|
|
## Docker Deployment
|
|
|
|
```bash
|
|
# Build and start all services
|
|
docker-compose up -d
|
|
|
|
# View logs
|
|
docker-compose logs -f
|
|
|
|
# Stop services
|
|
docker-compose down
|
|
```
|
|
|
|
## Admin Setup
|
|
|
|
### Create Admin User
|
|
|
|
```bash
|
|
cd backend
|
|
npm run setup:admin
|
|
```
|
|
|
|
Follow the prompts to create your first admin user.
|
|
|
|
### Login
|
|
|
|
1. Navigate to http://localhost:3000/admin/login
|
|
2. Enter your admin credentials
|
|
3. Access the admin dashboard
|
|
|
|
## Testing
|
|
|
|
### Backend Tests
|
|
|
|
```bash
|
|
cd backend
|
|
npm test
|
|
npm run test:watch
|
|
npm run test:coverage
|
|
```
|
|
|
|
### Frontend Tests
|
|
|
|
```bash
|
|
cd frontend
|
|
npm test
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Database Connection Issues
|
|
|
|
- Verify PostgreSQL is running
|
|
- Check `DATABASE_URL` in `.env`
|
|
- Ensure database exists: `CREATE DATABASE asle;`
|
|
|
|
### Migration Issues
|
|
|
|
```bash
|
|
# Reset database (WARNING: deletes all data)
|
|
npm run prisma:migrate reset
|
|
|
|
# Create new migration
|
|
npm run prisma:migrate dev --name migration_name
|
|
```
|
|
|
|
### Port Already in Use
|
|
|
|
Change `PORT` in `.env` or kill the process using the port:
|
|
|
|
```bash
|
|
# Find process
|
|
lsof -i :4000
|
|
|
|
# Kill process
|
|
kill -9 <PID>
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
1. Configure push notification providers
|
|
2. Set up KYC/AML provider credentials
|
|
3. Deploy smart contracts
|
|
4. Configure white-label instances
|
|
5. Set up monitoring and alerting
|
|
|
|
## Support
|
|
|
|
For issues or questions, see:
|
|
- [README.md](./README.md)
|
|
- [DEPLOYMENT.md](./DEPLOYMENT.md)
|
|
- [API_DOCUMENTATION.md](./API_DOCUMENTATION.md)
|
|
|