Installation Guide
This guide covers detailed installation instructions for PC Fix, including manual setup without Docker, all dependencies, database configuration, and deployment options.Prerequisites
Required Software
Node.js 20+
PostgreSQL 15+
Git
Docker (Optional)
System Requirements
- OS: Linux, macOS, or Windows with WSL2
- RAM: Minimum 4GB, recommended 8GB+
- Disk Space: 2GB for dependencies and builds
- Ports Available: 3001 (API), 4321 (Web), 5432 (PostgreSQL)
Installation Methods
- Manual Setup (Recommended for Development)
- Docker Compose (Quickest)
1. Clone the Repository
2. Install Dependencies
PC Fix uses NPM Workspaces for monorepo management. Install all dependencies from the root:packages/api and packages/web.--legacy-peer-deps to resolve conflicts.3. Set Up PostgreSQL Database
Option A: Local PostgreSQL Installation
Create a new database and user:Option B: Docker PostgreSQL Only
Run just the database in Docker:4. Configure API Environment Variables
Createpackages/api/.env:5. Configure Web Environment Variables
Createpackages/web/.env:6. Run Database Migrations
Generate Prisma Client and run migrations:prisma/schema.prisma.7. Seed the Database (Optional)
Populate the database with sample data:- Product categories (Processors, Graphics Cards, Memory, etc.)
- Sample brands (Intel, AMD, NVIDIA, etc.)
- Demo products with images
- Admin user account
- Sample orders and customers
8. Start Development Servers
Open two terminal windows:Terminal 1 - API Server:http://localhost:3001Terminal 2 - Web Server:http://localhost:43219. Verify Installation
- Visit http://localhost:4321 - Should show the PC Fix homepage
- Visit http://localhost:3001/api/health - Should return
{"status":"ok"} - Check database with Prisma Studio:
Opens at http://localhost:5555
Database Configuration
Prisma Schema Overview
PC Fix uses Prisma ORM with PostgreSQL. The schema includes:User & Authentication Models
User & Authentication Models
User: User accounts with role-based accessRefreshToken: JWT refresh token managementCliente: Extended customer profiles with addressesLocalidad&Provincia: Location data for Argentina
Product Models
Product Models
Producto: Product catalog with inventory trackingCategoria: Product categories (hierarchical)Marca: Brand managementImagenProducto: Multiple images per productFavorite: User wishlists
Shopping & Orders
Shopping & Orders
Cart&CartItem: Shopping cart managementVenta: Orders and salesItemVenta: Order line itemsPago: Payment tracking with multiple methods
Services & Support
Services & Support
ConsultaTecnica: Technical consultation requestsServicio: Service offeringsServicioPersonalizado: Custom service pricing
Content & Marketing
Content & Marketing
Banner: Homepage banners and promotionsSettings: Site configuration
Common Prisma Commands
External Services Configuration
Cloudinary (Image CDN)
Create Account
Get Credentials
- Cloud Name
- API Key
- API Secret
Add to .env
MercadoPago (Payment Gateway)
Create Account
Get API Credentials
- Access Token (for backend)
- Public Key (for frontend)
Add to .env
Google OAuth
Create Project
Enable OAuth
- Application type: Web application
- Authorized redirect URIs:
http://localhost:3001/api/auth/google/callback
Add Credentials
Resend (Email Service)
Create Account
Generate API Key
Verify Domain (Production)
Add to .env
Sentry (Error Monitoring)
Create Project
Get DSN
Add to Both .env Files
NPM Scripts Reference
Root Level Commands
API Package (packages/api)
Web Package (packages/web)
Troubleshooting
PostgreSQL Connection Errors
PostgreSQL Connection Errors
Error: P1001: Can't reach database serverSolutions:-
Verify PostgreSQL is running:
-
Check DATABASE_URL format:
-
Test connection directly:
Prisma Client Generation Issues
Prisma Client Generation Issues
Cannot find module '@prisma/client'Solution:Port Already in Use
Port Already in Use
Port 3001 (or 4321) is already in useSolutions:-
Find and kill the process:
-
Change port in
.env:
Module Not Found Errors
Module Not Found Errors
CORS Errors in Browser
CORS Errors in Browser
Access to fetch has been blocked by CORS policySolution:
Ensure API .env has correct CORS_ORIGIN:JWT Token Issues
JWT Token Issues
JsonWebTokenError: invalid signatureSolutions:- Ensure JWT secrets are set in
.env - Clear browser cookies and local storage
- Restart the API server after changing JWT secrets
TypeScript Build Errors
TypeScript Build Errors
- Update
@types/*packages - Check tsconfig.json settings
- Regenerate Prisma client
Production Deployment
Environment Preparation
Update Environment Variables
- Change all secrets (JWT, database passwords)
- Update CORS_ORIGIN to production domain
- Configure production database URL
- Set NODE_ENV=production
Build Applications
Run Database Migrations
Deployment Options
Vercel (Frontend)
- Connect GitHub repository
- Set root directory:
packages/web - Add environment variables
- Deploy automatically on push
Railway (Backend + DB)
- Create new project
- Add PostgreSQL database
- Deploy API from GitHub
- Configure environment variables
Docker Production
VPS (DigitalOcean, AWS)
- Set up Node.js 20+
- Install PostgreSQL
- Clone repository
- Configure PM2 or systemd
- Set up Nginx reverse proxy
Testing
Run Tests
Test Configuration
- Vitest: Unit testing for both packages
- Playwright: E2E testing for critical user flows
- Supertest: API endpoint testing
Next Steps
Explore the Codebase
- API structure:
packages/api/src/modules/ - Frontend components:
packages/web/src/components/ - Database schema:
packages/api/prisma/schema.prisma
Configure Admin Account
Customize Branding
- Update logo:
packages/web/public/logo.png - Modify colors:
packages/web/tailwind.config.mjs - Edit site metadata:
packages/web/src/layouts/Layout.astro