Overview
ARCA is a full-stack monorepo application built with NestJS (backend) and Next.js (frontend), managed by Turborepo. This guide will walk you through the initial setup process.Prerequisites
Before starting, ensure you have the following installed:Node.js
Version 18 or higher required
PostgreSQL
Any recent version (12+)
npm
Version 10 or higher
Git
For version control
Installation
Install Dependencies
Install all dependencies for the monorepo using npm workspaces:This command will install dependencies for:
- Root workspace
- Backend application (
apps/backend) - Frontend application (
apps/frontend) - Shared packages
Set Up Environment Variables
Create environment files for both applications. Start with the backend:Then edit
apps/backend/.env with your configuration. See the Configuration page for details.Configure Database Connection
In your Replace
apps/backend/.env file, set the DATABASE_URL:usuario, senha, and arca_db with your PostgreSQL credentials and database name.Run Database Migrations
Navigate to the backend directory and run Prisma migrations:This will create all required tables in your database.
Seed the Database
Populate the database with initial data (roles, users, lookup tables):This creates default users for each role:
- Admin:
[email protected]/Admin123! - Secretário:
[email protected]/Secretario123! - Supervisor:
[email protected]/Supervisor123! - Estagiário:
[email protected]/Estagiario123!
Start Development Servers
Start both backend and frontend in development mode:This runs both applications concurrently:
- Backend: http://localhost:3333
- Frontend: http://localhost:3000
Verify Installation
After starting the development servers:Check Backend API
Check Backend API
The backend API should be running on port 3333. You can verify it’s working by checking the health endpoint (if implemented) or attempting to access the API.
Check Frontend Application
Check Frontend Application
Open your browser and navigate to:You should see the ARCA login page.
Access Prisma Studio
Access Prisma Studio
Available Scripts
The monorepo includes several useful scripts:Project Structure
Understand the monorepo organization:Troubleshooting
Port Already in Use
Port Already in Use
If port 3333 or 3000 is already in use:
Database Connection Errors
Database Connection Errors
Ensure:
- PostgreSQL is running
- Database exists (create it if needed:
createdb arca_db) - Credentials in
.envare correct - Database URL format is correct
Prisma Client Not Generated
Prisma Client Not Generated
If you encounter Prisma Client errors:
TypeScript Errors
TypeScript Errors
Clear build cache and rebuild:
Next Steps
Configuration
Configure environment variables for your deployment
Database Setup
Learn more about database migrations and management
Production Deployment
Deploy ARCA to production environments
Architecture
Understand the system architecture