Skip to content

Prototype for Wet Bat Travel Agency - Full-Stack Developer Challenge Solution

Notifications You must be signed in to change notification settings

lucas-barbosa/wetbat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wet Bat Travel Agency Challenge MVP

Welcome to the Wet Bat Travel Agency project! This repository contains both the frontend and backend code for the Wet Bat Travel Agency prototype. The project was developed as part of a challenge and is hosted using free tier services. You can access it at https://lucas-barbosa.github.io/wetbat/.

Index

Introduction

The Wet Bat Travel Agency prototype is a full-stack application that aims to demonstrate the minimal quoting functionality for a travel agency. The project utilizes React for the frontend, Node.js for the backend, and Postgres for the database. The design and details of the prototype can be found in the challenge-description.pdf file within this repository.

💻 Live Demo

A live demo of the Wet Bat Travel Agency prototype is available at https://lucas-barbosa.github.io/wetbat/. Please note that the demo is hosted using free tier services, so performance and availability may vary.

👓 Project Overview

The Wet Bat Travel Agency prototype is built using the following technologies:

🖥️ Frontend:

  • React
  • Vite
  • TailwindCSS
  • TypeScript
  • React Query

⚙️ Backend:

  • NodeJS
  • Express.js
  • TypeScript
  • Prisma
  • Jest

The project utilizes a Dockerized development environment using docker-compose to run the services. However, it is also possible to run the services separately without Docker by configuring the required environment variables.

The backend is developed following the principles of Clean Architecture. This approach provides several benefits, including:

  • Separation of Concerns: Clean Architecture promotes modularity and separates business logic from external dependencies, making the codebase more maintainable and testable.
  • Flexibility: The architecture allows for easy swapping of libraries and frameworks, such as using Koa instead of Express or TypeORM instead of Prisma, without affecting the core business logic.
  • Testability: Clean Architecture encourages writing testable code, making it easier to write unit tests for business rules and application logic.

❔ Getting Started

📄 Prerequisites

To run the project, ensure you have the following installed:

  • Docker and docker-compose (if running with Docker)
  • Node.js (if running services separately)
  • PostgreSQL (if running services separately)

🔧 Development Setup

With Docker

  1. Clone the repository:
git clone https://github.com/lucas-barbosa/wetbat.git
  1. Change to the project directory:
cd wetbat
  1. Start the services using Docker Compose:
docker-compose up -d
  1. Access the frontend application at http://localhost:5000/wetbat

Running Services Separately

🎲 Database Setup

  1. Start a PostgreSQL database:
  • You can start a PostgreSQL database using Docker with the following command:
docker run -d --name wetbat-db -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword postgres:latest

This command starts a PostgreSQL container named "wetbat-db" with the password "mysecretpassword" and exposes port 5432.

⚙️ Backend Setup

  1. Clone the repository:
git clone https://github.com/lucas-barbosa/wetbat.git
  1. Change to the backend directory:
cd wetbat/backend
  1. Install dependencies:
yarn install
  1. Set the required environment variables by creating a .env file based on the provided .env.example file.
  • Add the following line to the .env file, replacing the value with the appropriate connection string for your PostgreSQL database (this example uses the connection string from the database created previously):
DATABASE_URL=postgres://postgres:mysecretpassword@localhost:5432/wetbat-db
  1. Run database migrations:
yarn prisma migrate deploy
  1. Start the backend server:
yarn dev

🖥️ Frontend Setup

  1. Change to the frontend directory:
cd wetbat/frontend
  1. Install dependencies:
yarn install
  1. Set the VITE_BACKEND_URL environment variable in a .env file to the backend URL (http://localhost:3000 if running the backend with Docker).

  2. Start the frontend development server:

yarn dev
  1. Access the frontend application at http://localhost:5173/wetbat.

🧪 Testing

The project includes unit tests for the backend services implemented using Jest. To run the tests, follow these steps:

  1. Change to the backend directory:
cd wetbat/backend
  1. Run the tests:
yarn test

🚀 Deployment

The Wet Bat Travel Agency project is deployed using the following services:

The backend is deployed on Render using the Dockerfile provided in the repository. The frontend is deployed on GitHub Pages, and the database uses PostgreSQL provided by Supabase.