Skip to content

Gaston202/Saffarni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 Saffarni

A full-stack travel platform to discover destinations, browse hotels & activities, plan trips, and book β€” with a secure auth flow and an admin management panel.

Saffarni is a full-stack web application built with a modern React frontend and a RESTful Node/Express + MongoDB backend. Users can explore travel destinations, view hotels and activities on an interactive map, plan trips, and make bookings, while administrators manage the platform's content through a dedicated admin area.

πŸ”— Live demo: saffarni.vercel.app


✨ Features

For travelers

  • πŸ” Discover destinations β€” browse curated travel destinations with details and imagery
  • 🏨 Hotels & activities β€” explore accommodations and things to do at each destination
  • πŸ—ΊοΈ Interactive maps β€” location views powered by Leaflet & OpenStreetMap
  • 🧳 Trip planning β€” assemble trips from destinations, hotels, and activities
  • πŸ“… Bookings β€” create and manage your bookings
  • πŸ” Authentication β€” secure JWT-based sign up / login with protected routes

For administrators

  • πŸ› οΈ Admin panel β€” manage destinations, hotels, activities, and trips
  • πŸ‘₯ User management β€” oversee user accounts
  • πŸ“Š Centralized CRUD β€” full create / read / update / delete over platform content

🧱 Tech Stack

Layer Technologies
Frontend React 19, Vite 7, React Router 7, Tailwind CSS v4, shadcn/ui (Radix UI), Lucide icons, React Hook Form, Axios, JWT Decode
Maps React-Leaflet + Leaflet (OpenStreetMap)
Backend Node.js, Express 5, Mongoose 8 (MongoDB), JWT (jsonwebtoken), bcryptjs, CORS, dotenv
Architecture MVC (Configuration / Controllers / Middleware / Models / Routes)
Deployment Vercel (frontend + serverless backend)

πŸ“ Project Structure

Saffarni/
β”œβ”€β”€ backend/                  # Node + Express REST API
β”‚   β”œβ”€β”€ Configuration/        # DB & environment setup
β”‚   β”œβ”€β”€ Controllers/          # Route handler logic
β”‚   β”œβ”€β”€ Middleware/           # Auth, error handling, etc.
β”‚   β”œβ”€β”€ Models/               # Mongoose schemas
β”‚   β”œβ”€β”€ Routes/               # API route definitions
β”‚   β”œβ”€β”€ index.js              # Server entry point
β”‚   β”œβ”€β”€ seedDestinations.js   # DB seeding script
β”‚   └── vercel.json           # Serverless deployment config
β”‚
└── saffarni-app/             # React + Vite frontend
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ Routes/           # App route definitions
    β”‚   β”œβ”€β”€ components/       # Reusable UI components
    β”‚   β”œβ”€β”€ context/          # React context (state/auth)
    β”‚   β”œβ”€β”€ services/         # API / business logic
    β”‚   β”œβ”€β”€ data/             # Static / seed data
    β”‚   β”œβ”€β”€ lib/              # Helpers (cn, utils)
    β”‚   β”œβ”€β”€ utils/            # Utility functions
    β”‚   β”œβ”€β”€ App.jsx           # Root component
    β”‚   └── main.jsx          # App entry point
    β”œβ”€β”€ tailwind.config.js
    └── vite.config.js

πŸš€ Getting Started

Prerequisites

1. Clone the repository

git clone https://github.com/Gaston202/Saffarni.git
cd Saffarni

2. Start the backend

cd backend
npm install
cp .env.example .env      # then fill in your environment variables
npm run seed              # optional: seed destinations into the DB
npm run dev               # starts the API with nodemon (http://localhost:PORT)

3. Start the frontend

cd ../saffarni-app
npm install
cp .env.example .env      # then point VITE_API_URL at your backend
npm run dev               # starts Vite dev server (http://localhost:5173)

πŸ”‘ Environment Variables

Configure each app from its .env.example file.

backend/.env β€” typical variables (confirm against .env.example):

PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=7d
CLIENT_URL=http://localhost:5173

saffarni-app/.env β€” typical variables (confirm against .env.example):

VITE_API_URL=http://localhost:5000

⚠️ Never commit real .env files. Only .env.example templates should be in version control.


πŸ“œ Available Scripts

Backend (/backend)

Command Description
npm run dev Start the API with nodemon (auto-reload)
npm start Start the API in production mode
npm run seed Seed the database with destination data

Frontend (/saffarni-app)

Command Description
npm run dev Start the Vite dev server
npm run build Build for production
npm run preview Preview the production build locally
npm run lint Run ESLint

🌐 API Overview

The backend exposes REST resources (mounted under the routes folder):

Resource Route file Purpose
Users UserRoute.js Auth (register/login), profile
Destinations DestinationRoute.js Browse & manage destinations
Hotels HotelRoute.js Browse & manage hotels
Activities ActivityRoute.js Browse & manage activities
Trips tripRoutes.js Trip assembly & management
Bookings BookingRoute.js Create & manage bookings
Admin adminRoutes.js Admin-only operations

Authentication is JWT-based: protected endpoints expect an Authorization: Bearer <token> header.


πŸ—ΊοΈ Roadmap

  • User reviews & ratings for hotels/activities
  • Payments integration
  • Search & filtering (price, location, category)
  • Multi-language support
  • Mobile-responsive polish & PWA

🀝 Contributing

Contributions are welcome! This is a personal/learning project, but feel free to fork and experiment.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is open-source and available under the MIT License.


πŸ‘€ Author

Gaston β€” GitHub @Gaston202

Built as a full-stack learning project to practice React, Node/Express, MongoDB, and deploying real apps to Vercel.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages