Quick Start Guide
This guide will help you set up and run the Procurement Calendar application on your local development machine.Prerequisites
Before you begin, ensure you have:- Node.js 18.x or higher installed on your system
- A Supabase account (free tier is sufficient for development)
- Git for cloning the repository
- A code editor (VS Code recommended)
The application uses Next.js 16.1.6 with React 19, so ensure your Node.js version is compatible.
Installation Steps
Clone the Repository
Clone the Procurement Calendar repository to your local machine:This will create a local copy of the project and navigate into the project directory.
Install Dependencies
Install all required npm packages:This will install all dependencies defined in
package.json, including:- Next.js framework and React
- Supabase client libraries
- UI components (Shadcn UI, Radix UI)
- FullCalendar for the calendar view
- TanStack Table for data tables
- Form libraries (React Hook Form, Zod)
- Tailwind CSS and styling utilities
The installation may take a few minutes depending on your internet connection.
Configure Environment Variables
Create a
The
.env.local file in the project root directory with your Supabase credentials:Finding Your Supabase Credentials
- Log in to your Supabase Dashboard
- Select your project (or create a new one)
- Go to Settings → API
- Copy the Project URL and anon/public key
Environment Variables Explained
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_SUPABASE_URL | Your Supabase project URL endpoint |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Public anonymous key for client-side requests |
NEXT_PUBLIC_ prefix makes these variables accessible in browser-side code, which is necessary for Supabase authentication and data fetching.Set Up Supabase Database
Initialize your Supabase database with the required schema:
- Open your Supabase project dashboard
- Navigate to the SQL Editor
- Open the file
supabase/schema.sqlfrom your local project - Copy the entire contents
- Paste into the Supabase SQL Editor
- Click Run to execute the schema
- Catalog tables:
proveedores,productos,presentaciones,destinos,estatus,unidades - Core tables:
profiles,requisiciones,requisiciones_historial - Row-Level Security policies for role-based access control
- Database functions for triggers and helpers
- Seed data with initial catalog entries
Verify Database Setup
After running the schema, verify the tables were created:- Go to Table Editor in Supabase
- You should see all tables listed
- Check that seed data exists in the
estatusandunidadestables
Run the Development Server
Start the Next.js development server:The application will start on
http://localhost:3000 by default.Available Scripts
Frompackage.json, these npm scripts are available:npm run dev- Start development server with hot reloadnpm run build- Build production-optimized applicationnpm run start- Run production build locallynpm run lint- Check code for linting errors
The development server includes hot module replacement (HMR), so changes to your code will automatically reflect in the browser.
Access the Application
Open your browser and navigate to:You will be redirected to the login page at
/login.First-Time Setup
- Click “Solicitar Acceso” (Request Access) tab
- Fill in the registration form:
- Full name
- Email address
- Password (minimum 6 characters)
- Confirm password
- Submit the form
Create an Admin User
For development, you’ll need to manually promote a user to admin:- Create an account through the registration form
- Go to Supabase Table Editor → profiles table
- Find your user record
- Change the
rolfield fromconsultatoadmin - Log out and log back in
Verify Installation
After completing the setup, verify everything works:1. Authentication
- Log in with your credentials
- Verify you’re redirected to
/dashboard/calendar
2. Calendar View
- The calendar should load without errors
- You should see the current month view
3. Navigation
- Check that sidebar navigation works
- Access different sections based on your role
4. Data Access
- Navigate to Catálogos (if admin/coordinadora)
- Verify seed data is visible in the catalog tables
Next Steps
Authentication & Roles
Learn about the authentication system and role-based permissions
Project Structure
Understand the codebase organization and key directories
Troubleshooting
Port Already in Use
If port 3000 is occupied, Next.js will automatically try 3001, 3002, etc. Or specify a custom port:Supabase Connection Issues
If you see authentication errors:- Verify your
.env.localfile has correct credentials - Check that environment variables are properly formatted
- Restart the development server after changing
.env.local
Database Schema Errors
If tables are missing:- Ensure the entire
schema.sqlfile was executed - Check for errors in the Supabase SQL Editor
- Drop tables and re-run the schema if needed
Module Not Found Errors
If you encounter missing module errors:Development Tools
Recommended VS Code Extensions
- ESLint - Code linting
- Tailwind CSS IntelliSense - CSS class autocompletion
- Prettier - Code formatting
- TypeScript and JavaScript Language Features - Enhanced IntelliSense
Browser Developer Tools
Use browser DevTools to:- Inspect network requests to Supabase
- Debug React components
- Monitor console for errors
- Test responsive layouts
Production Deployment
For production deployment instructions, refer to the deployment documentation. The application can be deployed to:- Vercel (recommended for Next.js)
- Netlify
- AWS Amplify
- Self-hosted Node.js server
You’re now ready to start developing with Procurement Calendar! If you encounter any issues, consult the troubleshooting section or reach out to the development team.
