A full-stack car rental platform for browsing vehicles, creating bookings, managing rental orders, and running admin fleet operations.
AutoRent combines a React/Vite frontend with a Go/Gin backend to deliver a complete rental workflow: public vehicle browsing, authenticated booking, user profiles, admin fleet management, news publishing, realtime support chat, AI-assisted vehicle search, and Ukrainian translation support.
The app is designed to run locally during development, ship through Docker, and publish the static frontend through GitHub Pages when configured.
| Area | What it includes |
|---|---|
| Showroom | Public vehicle listings, vehicle details, image browsing, and booking actions. |
| Booking | Pickup/return validation, date/time checks, and protected rental order creation. |
| Accounts | Email/password auth, optional Google sign-in, profile editing, and rental history. |
| Admin | Fleet CRUD, image uploads, customer ratings, rental order visibility, news tools, and support tools. |
| Support | Realtime chat, attachments, Enter-to-send, multiline messages, and admin/customer conversations. |
| Content | Public news page with admin-managed published articles. |
| AI and i18n | Gemini-powered car recommendations and optional DeepL Ukrainian translations. |
| Quality | Go tests, Vitest component tests, linting, build checks, CodeQL, and dependency review. |
| Layer | Tools |
|---|---|
| Frontend | React, TypeScript, Vite, Tailwind CSS, Framer Motion, lucide-react |
| Backend | Go, Gin, MySQL driver, JWT |
| Database | MySQL-compatible database with TiDB-style TLS defaults |
| Integrations | Google OAuth, Google Drive storage, Gemini, DeepL |
| Testing | Go test, Vitest, React Testing Library, jsdom |
| Delivery | Docker, Docker Compose, Nginx, GitHub Actions, GitHub Pages |
.
|- Backend/
| |- internal/ # API handlers, services, repositories, auth, storage
| |- migrations/ # SQL schema migrations
| |- Dockerfile
| `- main.go
|- Frontend/
| |- src/ # React app, components, data, API client, tests
| |- Dockerfile
| |- nginx.conf
| `- vite.config.js
|- docs/screenshots/ # Public README screenshots
|- .github/workflows/ # CI, CodeQL, dependency review, Pages deploy
`- compose.yml
Create a root .env file for Docker Compose and backend runtime settings. The values below are examples only.
# Backend server
PORT=8080
CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
# Database
DB_USER=root
DB_PASSWORD=
DB_HOST=localhost
DB_PORT=4000
DB_NAME=autorent
DB_TLS=tidb
# Auth
JWT_SECRET=change-this-secret
JWT_TOKEN_TTL=24h
ADMIN_SETUP_TOKEN=change-this-admin-setup-token
# Optional AI and translation
GEMINI_API_KEY=
GEMINI_MODEL=gemini-2.5-flash
DEEPL_API_KEY=
DEEPL_API_URL=https://api-free.deepl.com
# Optional Google auth
GOOGLE_AUTH_CLIENT_ID=
VITE_GOOGLE_AUTH_CLIENT_ID=
# Optional Google Drive storage
GOOGLE_DRIVE_OAUTH_CLIENT_ID=
GOOGLE_DRIVE_OAUTH_CLIENT_SECRET=
GOOGLE_DRIVE_OAUTH_REFRESH_TOKEN=
GOOGLE_DRIVE_CARS_FOLDER_ID=
GOOGLE_DRIVE_NEWS_FOLDER_ID=
GOOGLE_DRIVE_SUPPORT_FOLDER_ID=
# Upload limits
IMAGE_UPLOAD_MAX_BYTES=10485760
SUPPORT_ATTACHMENT_MAX_BYTES=10485760
# Frontend build/runtime
VITE_API_BASE_URL=http://localhost:8080
VITE_BASE_PATH=/
FRONTEND_PORT=3000Security notes:
- Do not commit real API keys, JWT secrets, OAuth client secrets, database passwords, refresh tokens, or admin setup tokens.
.env,Backend/.env,Frontend/.env, credential folders, service account JSON files, and Google Drive credential JSON files are ignored by git.DB_TLS=tidbis the backend default. UseDB_TLS=falsefor a local MySQL server without TLS.GEMINI_API_KEY,DEEPL_API_KEY, Google auth, and Google Drive settings are optional. The app disables those integrations when they are missing.
Apply migrations in order against your MySQL-compatible database:
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p "$DB_NAME" < Backend/migrations/001_create_users.sql
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p "$DB_NAME" < Backend/migrations/002_create_cars_and_images.sql
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p "$DB_NAME" < Backend/migrations/003_create_rental_orders.sql
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p "$DB_NAME" < Backend/migrations/004_create_news.sql
mysql -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p "$DB_NAME" < Backend/migrations/005_create_support_messages.sqlStart the backend:
cd Backend
go mod download
go run .Start the frontend in another terminal:
cd Frontend
npm ci
npm run devThe Vite dev server proxies /api requests to http://localhost:8080.
Run both services with Docker Compose:
docker compose up --buildThe frontend is served by Nginx on http://localhost:3000 by default, and the backend listens on http://localhost:8080.
This Compose file expects an external MySQL-compatible database configured through .env; it does not start a database container.
Backend:
cd Backend
go test ./...Frontend:
cd Frontend
npm run test
npm run lint
npm run buildOn Windows PowerShell, if npm is blocked by execution policy, use npm.cmd:
npm.cmd run test
npm.cmd run build| Area | Endpoint |
|---|---|
| Health | GET /health |
| Auth | /api/auth |
| Cars | /api/cars |
| Rental orders | /api/rental-orders |
| News | /api/news |
| Support | /api/support |
| AI recommendation | /api/ai/car-recommendation |
| Translation | /api/translate |
| Admin | /api/admin |
Admin APIs require an admin JWT.
- The frontend Docker image builds static assets and serves them through Nginx.
- The backend Docker image runs the compiled Go API on port
8080. - GitHub Actions include CI checks, Docker build smoke tests, CodeQL, dependency review, and GitHub Pages deployment for the frontend.
- For GitHub Pages deployments, configure
VITE_API_BASE_URLso the static frontend can reach the deployed backend API.