Documentation Index
Fetch the complete documentation index at: https://mintlify.com/No-Country-simulation/S02-26-Equipo-33-Web-App/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart Guide
Get the Horse Trust platform running locally in just a few minutes. This guide will walk you through cloning the repository, installing dependencies, configuring environment variables, and starting both the client and server applications.Prerequisites
Before you begin, ensure you have the following installed:Node.js
Version 24.13.0 or higher
Git
Version 2.43.0 or higher
MongoDB
MongoDB Atlas account or local MongoDB instance
npm
Comes bundled with Node.js
Installation
Clone the Repository
Clone the Horse Trust repository to your local machine:The repository follows a monorepo structure with separate
client and server directories.Set Up the Backend Server
Navigate to the server directory and install dependencies:The server will start on You should receive a response like:
Configure Server Environment Variables
Create a.env file in the server directory based on .env.example:server/.env
The
JWT_SECRET should be a long, random string. In production, use a cryptographically secure random value.Start the Server
Run the development server:http://localhost:8031 (or the port specified in your .env file).Test the Server
Verify the server is running by testing the health endpoint:Set Up the Frontend Client
Open a new terminal window and navigate to the client directory:The client will start on
Configure Client Environment Variables
Create a.env.local file in the client directory:client/.env.local
The
NEXT_PUBLIC_API_URL should point to your backend server. Make sure the port matches your server configuration.Start the Client
Run the Next.js development server:http://localhost:8030.Development Workflow
Running Both Services
For development, you’ll need two terminal windows:Available Scripts
Backend Scripts
server/package.json
Frontend Scripts
client/package.json
Authentication Flow
Register a New User
Use the registration action to create a new account:client/app/actions/auth.ts
Login Flow
Creating Your First Horse Listing
Once logged in as a seller, you can create horse listings:client/app/actions/horses.ts
Horse Data Structure
At least 3 photos are required for each horse listing. The platform validates this at the database level.
Real-time Chat Setup
The platform uses Socket.io for real-time messaging between buyers and sellers:server/src/index.ts
Troubleshooting
Common Issues
MongoDB Connection Failed
MongoDB Connection Failed
- Verify your
MONGO_URIis correct - Check if your IP address is whitelisted in MongoDB Atlas
- Ensure network connectivity to MongoDB
- Check MongoDB Atlas cluster status
CORS Errors
CORS Errors
- Ensure
CORS_ORIGINSin server.envincludes your client URL - Check that both frontend and backend are running
- Verify the
NEXT_PUBLIC_API_URLmatches your backend URL
Port Already in Use
Port Already in Use
Change the port in your
.env files:- Server: Update
PORTinserver/.env - Client: Update the
-pflag inclient/package.jsonscripts
JWT Token Issues
JWT Token Issues
- Ensure
JWT_SECRETis set in server.env - Check token expiration (default 10 days)
- Clear browser cookies and re-login
Database Auto-Reconnect
The platform includes an automatic database reconnection feature:client/app/utils/apiFetch.ts
The
/health/reconnect endpoint called by the frontend is referenced in the client code but not yet implemented in the backend API. The frontend includes this code for future database reconnection functionality.Next Steps
Architecture Overview
Learn about the system architecture and how components interact
API Reference
Explore the complete API documentation
Contributing
Learn how to contribute to the Horse Trust project
Deployment
Deploy Horse Trust to production
For production deployment, remember to:
- Use strong, unique values for
JWT_SECRET - Set
NODE_ENV=production - Configure proper CORS origins
- Use SSL/TLS certificates
- Set up proper MongoDB authentication
- Enable security features (Helmet, rate limiting)

