Installation Guide
This guide covers detailed installation instructions for PC Fix, including manual setup without Docker, all dependencies, database configuration, and deployment options.For a quick Docker-based setup, see the Quick Start Guide. This guide is for developers who need manual installation or want to understand the complete setup process.
Prerequisites
Required Software
Node.js 20+
PostgreSQL 15+
Git
Docker (Optional)
Download from docker.comOnly required for containerized deployment
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)
Best for: Active development, debugging, and customizationThis installs dependencies for both This creates all database tables according to the schema in This creates:The API will start at The frontend will start at
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.If you encounter peer dependency warnings, the project uses
--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
Sign up at cloudinary.com
MercadoPago (Payment Gateway)
Create Account
Sign up at mercadopago.com
Get API Credentials
Navigate to Developers → Credentials:
- Access Token (for backend)
- Public Key (for frontend)
Google OAuth
Create Project
Go to Google Cloud Console
Enable OAuth
APIs & Services → Credentials → Create OAuth Client ID
- Application type: Web application
- Authorized redirect URIs:
http://localhost:3001/api/auth/google/callback
Resend (Email Service)
Create Account
Sign up at resend.com
Sentry (Error Monitoring)
Create Project
Sign up at sentry.io and create a project
NPM Scripts Reference
Root Level Commands
API Package (packages/api)
Web Package (packages/web)
Troubleshooting
PostgreSQL Connection Errors
PostgreSQL Connection Errors
Error:
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
Error: After schema changes, always regenerate the client.
Cannot find module '@prisma/client'Solution:Port Already in Use
Port Already in Use
Error:
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
Error: Various “Cannot find module” errorsSolution:
CORS Errors in Browser
CORS Errors in Browser
Error: For multiple origins:
Access to fetch has been blocked by CORS policySolution:
Ensure API .env has correct CORS_ORIGIN:JWT Token Issues
JWT Token Issues
Error:
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
Solution:Common fixes:
- 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
Deployment Options
Vercel (Frontend)
Best for: Astro frontend deployment
- Connect GitHub repository
- Set root directory:
packages/web - Add environment variables
- Deploy automatically on push
Railway (Backend + DB)
Best for: Express API and PostgreSQL
- Create new project
- Add PostgreSQL database
- Deploy API from GitHub
- Configure environment variables
Docker Production
Best for: Self-hosted deployments
VPS (DigitalOcean, AWS)
Best for: Full control deployments
- 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
Create admin user via Prisma Studio or seed script to access admin dashboard
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
Set Up External Services
Configure Cloudinary, MercadoPago, and email services for full functionality