Eulav Technical Documentation
Table of Contents
1. Introduction
2. System Overview
3. Architecture
4. Installation
5. Configuration
6. API Reference
7. Security Considerations
8. Database Schema
9. Testing
10.Deployment
11.Maintenance
12.Troubleshooting
13.Glossary
14.References
1. Introduction
This document provides technical details for engineers working on the Eulav system. It covers
the system's architecture, setup, configuration, API, database, and troubleshooting steps. This
documentation serves as a comprehensive guide for development, deployment, and
maintenance of the Eulav platform.
2. System Overview
Eulav is a multi-platform application consisting of both web and mobile clients with a centralized
backend. The system is designed to provide a seamless experience across different devices
while maintaining consistent data and business logic.
Key components include:
● Web application built with Next.js and Tailwind CSS
● Mobile application built with React Native (Expo)
● Backend API service built with Nest.js
● MySQL database for data persistence
● Prisma ORM for database access and management
3. Architecture
Frontend
● Web Client:
○ Built with Next.js (latest version)
○ Styled with Tailwind CSS and shadcn component library
○ Responsive design for cross-device compatibility
● Mobile Client:
○ Built with React Native (Expo)
○ Cross-platform support for iOS and Android
○
Backend
● API Server:
○ Nest.js framework
○ RESTful API design
○ JWT authentication
○ Prisma ORM for database access
● Database:
○ MySQL v11.4.2
○ Managed through Prisma schema
Infrastructure
● Repository Structure:
○ Separate repositories for frontend and backend
○ Frontend: https://github.com/Eulav-Payments/eulav-fe
○ Backend: https://github.com/Eulav-Payments/eulav-ap
○ Mobile: https://github.com/Eulav-Payments/eulav-native
Diagram:
[Web Client (Next.js)] ----\
\
---> [Backend API (Nest.js)] ---> [MySQL
Database]
/
[Mobile Client (React Native)] ---/
4. Installation
Prerequisites
● Node.js v18 or higher
● Git
● MySQL v11.4.2
Backend Setup
Clone the repository:
git clone https://github.com/[organization]/eulav-api.git
1. cd eulav-api
2. Install dependencies:
bash
Copy
npm install
3. Set up environment variables:
bash
Copy
cp .env.example .env
4. Update the .env file with your database credentials and other required values.
5. Run database migrations:
bash
Copy
npx prisma migrate dev
6. Start the development server:
bash
Copy
npm run start:dev
Web Frontend Setup
Clone the repository:
git clone https://github.com/Eulav-Payments/eulav-fe.git
1. cd eulav-frontend
2. Install dependencies:
npm install
3. Set up environment variables:
cp .env.example .env.local
4. Update the .env.local file with your API endpoints and other required values.
5. Start the development server:
npm run dev
Mobile App Setup
1. Navigate to the mobile app directory (assuming it's in the same repository as the web
frontend)
cd eulav-native
2. Install dependencies:
npm install
3. Start the Expo development server:
npx expo start
5. Configuration
Backend Configuration
Configuration files are located in the config/ directory of the backend repository. Key settings
include:
● app.module.ts for application-level configuration
● .env for environment-specific variables
Example .env file:
# Database
DATABASE_URL="mysql://user:password@localhost:3306/eulav"
# JWT
JWT_SECRET="your-secret-key"
JWT_EXPIRATION="1d"
# App
PORT=3000
NODE_ENV=development
Frontend Configuration
Configuration for the web frontend is primarily managed through:
● .env.local for local development
● .env.production for production builds
Example .env.local file:
NEXT_PUBLIC_API_URL=http://localhost:3000/api
NEXT_PUBLIC_ENVIRONMENT=development
6. API Reference
The Eulav API is documented using Swagger and is available at:
https://eulav-api-staging.up.railway.app/docs#/
The Swagger documentation provides comprehensive details on all available endpoints,
request/response formats, and authentication requirements.
Some example endpoints include:
Authentication
● POST /auth/login
○ Description: Authenticate a user and receive a JWT token
○ Request body: { "email": "string", "password": "string" }
○ Response: { "accessToken": "string", "user": {...} }
Users
● GET /users
○ Description: Retrieve a list of users (requires authentication)
○ Headers: Authorization: Bearer {token}
○ Response: Array of user objects
● POST /users
○ Description: Create a new user
○ Request body: User object
○ Response: Created user object
For complete API documentation, please refer to the Swagger documentation linked above.
7. Security Considerations
Authentication
● JWT (JSON Web Tokens) for stateless authentication
● Tokens expire after a configurable time period (default: 1 day)
● Refresh token mechanism for extended sessions
Authorization
● Role-based access control for API endpoints
● Middleware for route protection
Data Protection
● HTTPS enforced for all API communication
● AWS WAF (Web Application Firewall) for additional protection
● Input validation on all API endpoints
● Parameterized queries via Prisma to prevent SQL injection
Best Practices
● Environment variables for sensitive configuration
● No credentials stored in the codebase
● Regular security updates for all dependencies
8. Database Schema
The Eulav database schema is managed through Prisma and can be found in the
prisma/schema.prisma file in the backend repository. The schema is also documented at
the bottom of the Swagger documentation.
Example schema structure:
model User {
id String @id @default(uuid())
email String @unique
password String
firstName String?
lastName String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Profile {
id String @id @default(uuid())
userId String @unique
user User @relation(fields: [userId], references: [id])
// additional fields
}
// Additional models as per the application requirements
For the complete database schema, please refer to the prisma/schema.prisma file in the
backend repository or the Swagger documentation.
9. Testing
QA Testing
● Manual testing is performed on new features and bug fixes
● Testing is conducted on both staging and development environments before production
deployment
Test Environments
● Development: For initial feature testing
● Staging: For pre-production verification
10. Deployment
Backend Deployment
The backend API is deployed using Railway with separate environments for staging and
production.
● Automatically deployed when changes are merged to the main branch
○ URL: https://eulav-api-staging.up.railway.app
Frontend Deployment
The web frontend is deployed using AWS Amplify with separate environments for staging and
production.
● Staging: Automatically deployed when changes are merged to the main branch
○ URL: https://staging-dev.eulav.io
● Production: Manually deployed from the staging branch to the production branch
○ URL: https://app.eulav.io
Deployment Process
1. Code changes are made in feature branches
2. Pull requests are submitted for review
3. CI checks ensure that the build is successful
4. Upon approval, the PR is merged to the main branch
5. Automatic deployment to the staging environment occurs
6. QA testing is performed on the staging environment
7. Manual deployment to production is initiated when ready
11. Maintenance
Regular Maintenance
● Dependency updates: Monthly review and update of all dependencies
● Database backups: Daily automated backups
● Log rotation: Configured to prevent disk space issues
Scheduled Maintenance
● Communicate planned maintenance windows to users at least 48 hours in advance
● Schedule maintenance during off-peak hours (preferably weekends or late nights)
● Have a rollback plan for each maintenance activity
Performance Monitoring
● Monitor API response times and error rates
● Set up alerts for abnormal patterns
● Review logs for recurring issues
12. Troubleshooting
Common Issues
Backend Issues
● Issue: Application fails to connect to MySQL database
○ Solution: Verify database credentials in the .env file and check if MySQL service
is running
● Issue: Prisma migration errors
○ Solution: Check migration history and resolve conflicts, or reset the database if
in development
Frontend Issues
● Issue: API connectivity problems
○ Solution: Verify API URL configuration and network connectivity
● Issue: Build failures in AWS Amplify
○ Solution: Check build logs for errors, ensure all dependencies are properly
installed
Logging
● Backend logs are available through Railway dashboard
● Frontend build logs are available in AWS Amplify console
13. Glossary
● JWT: JSON Web Token, used for authentication
● ORM: Object-Relational Mapping, Prisma in our case
● API: Application Programming Interface
● CI/CD: Continuous Integration/Continuous Deployment
14. References
● Next.js Documentation
● React Native Documentation
● Nest.js Documentation
● Prisma Documentation
● MySQL Documentation
● Railway Documentation
● AWS Amplify Documentation