Deployment Guide
Relevant source files
The following files were used as context for generating this wiki page:This guide provides comprehensive instructions for deploying the GUC Resume Enhancer application. The project is a Next.js application that uses Supabase for its PostgreSQL database and file storage, and integrates with various third-party AI services for resume enhancement.
The deployment process involves setting up the local environment, configuring the backend services on Supabase, populating environment variables, and running the production build. Following these steps will ensure a secure and functional deployment. For information on integrating this tool into an existing dashboard, see the Integration Guide.
Architecture Overview
The application consists of a Next.js frontend and backend, a Supabase project for data and file persistence, and external AI provider APIs.
This diagram illustrates the high-level architecture of the system.
1. Prerequisites
Before starting the deployment, ensure you have the following:
- Node.js version 18 or higher.
- A Supabase account and a new project created.
- API keys for at least one AI provider (OpenAI, Anthropic, or Google Gemini).
Sources: README.md:39, INTEGRATION_GUIDE.md:14
2. Initial Setup
2.1. Clone and Install Dependencies
First, clone the repository and install the required npm packages.
git clone https://github.com/GustheTrader/GUC-Resume-Enhancer.git
cd GUC-Resume-Enhancer
npm install
Sources: README.md:44-48
The key dependencies for the application are listed in package.json.
| Package | Version | Description |
|---|---|---|
next | 14.2.28 | The React framework for the application. |
@prisma/client | 6.7.0 | The ORM used to interact with the PostgreSQL database. |
@supabase/supabase-js | ^2.39.0 | Client library for interacting with Supabase services (e.g., Storage). |
next-auth | 4.24.11 | Handles user authentication. |
pdf-parse | 1.1.1 | Parses text content from PDF files during upload. |
mammoth | ^1.11.0 | Parses text content from DOCX files during upload. |
pdf-lib | ^1.17.1 | Used for generating PDF documents for download. |
Sources: package.json:34-90, INTEGRATION_GUIDE.md:20-30
2.2. Environment Configuration
Create a .env file in the root of the project and populate it with the necessary credentials and keys.
| Variable | Description | Example |
|---|---|---|
DATABASE_URL | Connection string for the Supabase PostgreSQL database. | postgresql://postgres:[PASSWORD]@db.vpvvcwvebjtibafsceqx.supabase.co:5432/postgres |
NEXT_PUBLIC_SUPABASE_URL | The public URL for your Supabase project. | https://vpvvcwvebjtibafsceqx.supabase.co |
NEXT_PUBLIC_SUPABASE_ANON_KEY | The anonymous/public key for your Supabase project. | your-supabase-anon-key |
SUPABASE_SERVICE_ROLE_KEY | The secret service role key for privileged backend operations. | your-supabase-service-role-key |
NEXTAUTH_SECRET | A secret key for NextAuth to sign tokens. | your-random-secret-key |
NEXTAUTH_URL | The canonical URL of your application. | http://localhost:3000 |
ENCRYPTION_KEY | A 32-character key for encrypting user API keys in the database. | your-32-character-encryption-key |
OPENAI_API_KEY | (Optional) System-wide API key for OpenAI. | sk-your-openai-key |
ANTHROPIC_API_KEY | (Optional) System-wide API key for Anthropic. | sk-ant-your-anthropic-key |
GOOGLE_API_KEY | (Optional) System-wide API key for Google Gemini. | your-google-key |
Sources: README.md:54-70, SUPABASE_SETUP.md:78-95
3. Supabase Configuration
This application relies on Supabase for both the database and file storage.
Sources: SUPABASE_SETUP.md
3.1. Database Schema Setup
The database schema is managed by Prisma. The models define the structure for users, resumes, enhancements, and system data.
This ER diagram shows the relationships between the database tables.
Sources: schema.prisma:35-131
To apply this schema to your Supabase database, run the following Prisma commands:
# Generate the Prisma client based on your schema
npx prisma generate
# Push the schema to the database, creating tables and columns
npx prisma db push
Sources: README.md:73-74, SUPABASE_SETUP.md:57-60
3.2. Storage Bucket Setup
A private storage bucket named resumes is required to store uploaded resume files.
- In your Supabase dashboard, navigate to Storage.
- Click Create a new bucket.
- Set the name to
resumesand ensure it is not public.
Sources: SUPABASE_SETUP.md:28-35
3.3. Storage Security Policies
To ensure users can only access their own files, you must apply Row Level Security (RLS) policies to the storage.objects table for the resumes bucket.
Policy for Uploads (INSERT):
CREATE POLICY "Users can upload their own resumes"
ON storage.objects FOR INSERT
TO authenticated
WITH CHECK (
bucket_id = 'resumes'
AND auth.uid()::text = (storage.foldername(name))[1]
);
Policy for Reads (SELECT):
CREATE POLICY "Users can read their own resumes"
ON storage.objects FOR SELECT
TO authenticated
USING (
bucket_id = 'resumes'
AND auth.uid()::text = (storage.foldername(name))[1]
);
Policy for Deletes (DELETE):
CREATE POLICY "Users can delete their own files"
ON storage.objects FOR DELETE
TO authenticated
USING (
bucket_id = 'resumes'
AND auth.uid()::text = (storage.foldername(name))[1]
);
Sources: SUPABASE_SETUP.md:42-68
The file storage structure is designed to be per-user, where {userId} corresponds to the user's authentication ID.
resumes/
├── {userId}/
│ ├── {timestamp}-resume1.pdf
│ └── {timestamp}-resume2.docx
Sources: SUPABASE_SETUP.md:118-123, api/resumes/upload/route.ts:100-105
4. Building and Running for Production
Once the environment and backend are configured, you can build and start the application.
4.1. Deployment Flow
This flowchart outlines the end-to-end process for deploying the application.
Sources: README.md, SUPABASE_SETUP.md
4.2. Production Commands
The following scripts from package.json are used for production builds.
# Build the Next.js application for production
npm run build
# Start the production server
npm run start
Sources: package.json:5-6, README.md:144-145
4.3. Final Production Checklist
Before going live, review these critical steps:
- Environment Variables: Ensure all variables from your
.envfile are set in your hosting platform's environment (e.g., Vercel, Netlify). - Database Migrations: For production, it is recommended to use
npx prisma migrate deployinstead ofdb push. - Security:
- Rotate all secrets and keys.
- Enable Row Level Security (RLS) on all sensitive database tables.
- Review storage policies to ensure they are not overly permissive.
- Performance:
- Enable database connection pooling if supported by your hosting provider.
- Configure a CDN for static assets.
Sources: INTEGRATION_GUIDE.md:216-231
Summary
Deploying the GUC Resume Enhancer involves a coordinated setup of the Next.js application and a Supabase backend. The most critical steps are correctly configuring the environment variables, setting up the database schema with Prisma, and securing the file storage bucket with RLS policies. By following this guide, you can create a robust and secure instance of the application.