almanar-racing / README.md
Al Manar Racing
Al manar racing website + e-store project
Al Manar Racing
Al Manar Racing website + e-store project with Next.js web application and Go backend.
๐ Tech Stack
Frontend
- Next.js 16.1.6 - React framework
- React 19.2.3 - UI library
- TypeScript 5 - Type safety
- SCSS Modules - Component styling
- SWR - Data fetching and caching
- ESLint - Code linting
CMS (Content Management)
- Strapi 5.39.0 - Headless CMS
- PostgreSQL 16.4 - Database
- Docker Compose - Container orchestration
๐ Project Structure
almanar-racing/
โโโ web/ # Next.js web application
โ โโโ app/ # App router pages
โ โโโ components/ # React components
โ โโโ hooks/ # Custom React hooks (SWR data fetching)
โ โโโ lib/ # Utilities (Strapi client)
โ โโโ public/ # Static assets
โ โโโ styles/ # Global styles
โ โโโ package.json # Frontend dependencies
โโโ strapi/ # Strapi CMS
โ โโโ src/ # API content types and components
โ โโโ config/ # Strapi configuration
โ โโโ scripts/ # Database seeding scripts
โ โโโ data/ # Seed data and uploads
โ โโโ package.json # CMS dependencies
โโโ docker-compose.yml # Docker services configuration
โโโ README.md # This file
๐ ๏ธ Prerequisites
Before you begin, ensure you have the following installed:
- Docker and Docker Compose - For running services
- Node.js 18+ and npm - For local development (optional)
- Go 1.24+ - For backend development (optional)
๐ Getting Started
Quick Start with Docker (Recommended)
-
Clone the Repository
git clone https://github.com/rihal-om/almanar-racing.git cd almanar-racing -
Start All Services
docker-compose up -dThis will start:
- Web Application at
http://localhost:3000 - Strapi CMS at
http://localhost:1337 - PostgreSQL Database on port
5433
- Web Application at
-
Access the Applications
- Website: http://localhost:3000
- Strapi Admin: http://localhost:1337/admin (create admin account on first visit)
-
Stop Services
docker-compose down
First-Time Setup
On first run, the Strapi database will be automatically seeded with sample content including:
- Articles (news, press releases, events)
- Racing event details
- Store products
- Hero banner content
- Car specifications
1. Clone the Repository (Replaced by Docker Quick Start above)
2. Setup Backend
cd backend
go mod download
go run main.go
The backend server will start at http://localhost:8080
Available endpoints:
GET /api/health- Health check endpoint
3. Setup Web Application
Open a new terminal:
cd web
npm install
npm run dev
The web application will start at http://localhost:3000
๐ Content Management
Managing Articles and Content
All website content is managed through the Strapi Admin Panel:
- Access Strapi Admin: http://localhost:1337/admin
- Create Admin Account (first time only)
- Manage Content through the Content Manager:
- Articles: News, press releases, events, announcements
- Racing Events: Upcoming race details and results
- Store Products: Merchandise and products
- Hero Banner: Homepage hero section content
- Car Specifications: Vehicle technical details
- About Section: Team information
Article Management
To create or update articles:
- Login to Strapi Admin Panel
- Navigate to Content Manager โ Article
- Click "+ Create new entry" or edit existing articles
- Fill in the fields:
- Title, Description, Badge (NEWS/PRESS/EVENT/ANNOUNCEMENT)
- Upload cover image
- Select author and category
- Add rich content blocks
- Set featured status and display order
- Click "Save" and then "Publish"
๐ Full Guide: See STRAPI_ARTICLE_MANAGEMENT.md for detailed instructions
Strapi Scripts
Useful scripts for managing Strapi content:
# Inside strapi container or cd strapi/
npm run seed:example # Seed database with sample data
npm run seed:force-home # Force import home page content
npm run publish:content # Publish all content
npm run update:badges # Update article badges
npm run check:content # Check content status
๐งช Development
Running the Backend
cd backend
go run main.go
Running the Web Application
cd web
npm run dev
Building for Production
Backend:
cd backend
go build -o bin/server main.go
./bin/server
Web Application:
cd web
npm run build
npm run start # Start production server
๐ Available Scripts
Docker Commands
docker-compose up -d- Start all services in backgrounddocker-compose down- Stop all servicesdocker-compose logs -f- View logsdocker-compose restart strapi- Restart Strapi CMSdocker exec -it almanar-racing-strapi-1 sh- Access Strapi container
Web Application Scripts
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLint
Strapi Scripts (run inside strapi container)
npm run develop- Start Strapi in development modenpm run seed:example- Seed database with sample datanpm run publish:content- Publish all contentnpm run update:badges- Update article badges
Backend Commands
go run main.go- Run development servergo build- Build binarygo test ./...- Run tests (when added)
๐ง Configuration
Environment Variables
Web Application (web/.env.local or Docker environment):
NEXT_PUBLIC_STRAPI_URL- Strapi API URL for browser (default: http://localhost:1337)STRAPI_URL- Strapi API URL for server-side (default: http://strapi:1337)
Strapi CMS (strapi/.env or docker-compose.yml):
DATABASE_CLIENT- postgresDATABASE_HOST- Database hostnameDATABASE_PORT- 5432DATABASE_NAME- al_manar_racingDATABASE_USERNAME- strapiDATABASE_PASSWORD- strapi_passwordJWT_SECRET- Random secret keyADMIN_JWT_SECRET- Admin JWT secretAPP_KEYS- Application keysAPI_TOKEN_SALT- API token salt
Ports
- 3000: Web application
- 1337: Strapi CMS and API
- 5433: PostgreSQL database (mapped from internal 5432)
Web Application API URL
The web application connects to Strapi at http://localhost:1337 (browser) and http://strapi:1337 (server-side). Update API calls in the application if you change the Strapi URL.
๐ฆ Project Status
This is a fully functional racing team website with:
โ Completed Features
- Next.js Web Application with TypeScript and SCSS
- Strapi Headless CMS for content management
- Docker Compose setup for easy deployment
- PostgreSQL database with seeded content
- SWR Data Fetching with custom hooks
- Homepage Sections:
- Hero banner with driver statistics
- Car specifications (Engineered section)
- Performance/Racing calendar
- Store products showcase
- Latest news and updates
- Article Management:
- Create, edit, publish articles
- Badge categories (NEWS, PRESS, EVENT, ANNOUNCEMENT)
- Rich content with dynamic blocks
- Author and category relations
- Content Types:
- Articles with cover images
- Racing event details
- Store products
- Hero banners
- Newsletter sections
- Admin Features:
- Strapi admin panel for content editing
- User permissions and roles
- Media library for images
- Draft & publish workflow
๐ง In Development
- Backend Go API integration
- E-commerce functionality
- User authentication
- Event registration system
๐ Documentation
- โ Main README (this file)
- โ Article Management Guide (STRAPI_ARTICLE_MANAGEMENT.md)
- โ Strapi seeding scripts
- โ API integration examples
โก Strapi Data Seeding & Scripts
To populate Strapi with sample data or update content, use the provided scripts. These can be run inside the Strapi container or from the strapi directory:
# Seed the database with example data (articles, events, products, etc.)
docker compose exec strapi node scripts/seed.js
# OR (if running locally)
npm run seed:example
# Force import home page content only
docker compose exec strapi node scripts/force-seed-home.js
# OR
npm run seed:force-home
# Publish all content (set publishedAt)
docker compose exec strapi node scripts/publish-content.js
# OR
npm run publish:content
# Update article badges
docker compose exec strapi node scripts/update-article-badges.js
# OR
npm run update:badges
# Check content status
docker compose exec strapi node scripts/check-content.js
# OR
npm run check:content
Note: If you see errors about missing files (e.g., images in
data/uploads), make sure all referenced files exist and are mounted into the container via Docker volumes.
For more details, see the scripts in strapi/scripts/ and the seed data in strapi/data/data.json.
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is proprietary software for Al Manar Racing.