The headless CMS and API layer powering the Faizane Madina Masjid Southend digital platform.
This backend serves as the primary API for the Faizane Madina Masjid Southend website frontend.
- Frontend Repository: Faizane-Madina-Masjid-Southend/frontend
This repository contains the backend source code for the Faizane Madina Masjid Southend project.
Built with Strapi v5, this Headless CMS serves as the centralised data management hub for the mosque's administration. It provides a user-friendly admin panel for non-technical staff to update prayer times, announcements, and gallery images, which are then consumed by the React frontend via a RESTful API.
The CMS is structured around specific data models tailored to mosque operations:
- Timetables: Stores monthly prayer schedules with support for complex JSON prayer data, specific months, and years.
- Weekly Events: Manages recurring weekly classes (Madrasa) and gatherings (Ijtimah/Jummah) with specific day/time enumerations.
- Announcements: A rich-text content type for publishing news and updates to the digital noticeboard.
- Services: Manages the list of community services offered by the mosque.
- Gallery: Handles media uploads for the frontend image gallery.
- Cloudinary Integration: Configured with
@strapi/provider-upload-cloudinaryto offload media storage and delivery, ensuring optimised image loading for the frontend.
- CORS Configuration: Strictly configured middleware to allow requests only from authorised origins (e.g., local development ports, production domains).
- Role-Based Access Control: Utilises Strapi's Users & Permissions plugin to secure API endpoints.
- Core Framework: Strapi v5 (Headless CMS)
- Language: TypeScript
- Database: PostgreSQL (
pgclient configured) - Media Provider: Cloudinary
- Environment: Node.js (>=18.0.0)
- Node.js (v18 or higher)
- A PostgreSQL database instance (or SQLite for local testing if configured).
- A Cloudinary account for media storage.
Clone the repository and install dependencies:
git clone [https://github.com/Faizane-Madina-Masjid-Southend/backend.git](https://github.com/Faizane-Madina-Masjid-Southend/backend.git)
cd backend
npm installCreate a .env file in the root directory. You can use .env.example as a template:
# Server Configuration
HOST=0.0.0.0
PORT=1337
# Secrets (Generate new keys for production)
APP_KEYS="toBeModified1,toBeModified2"
API_TOKEN_SALT=tobemodified
ADMIN_JWT_SECRET=tobemodified
TRANSFER_TOKEN_SALT=tobemodified
JWT_SECRET=tobemodified
# Database (PostgreSQL)
DATABASE_CLIENT=postgres
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=strapi
DATABASE_USERNAME=strapi
DATABASE_PASSWORD=strapi
DATABASE_SSL=false
# Cloudinary Configuration
CLOUDINARY_NAME=your_cloud_name
CLOUDINARY_KEY=your_api_key
CLOUDINARY_SECRET=your_api_secretStart the development server with auto-reload:
npm run developThe Admin Panel will be accessible at http://localhost:1337/admin.
The backend exposes the following primary API endpoints (mapped from src/api):
| Content Type | Endpoint | Description |
|---|---|---|
| Announcement | /api/announcements |
News and updates content. |
| Gallery | /api/gallery |
Collection of images for the website gallery. |
| Service | /api/services |
List of mosque services. |
| Timetable | /api/timetables |
Monthly prayer time data (JSON format) and media. |
| Weekly Event | /api/weekly-events |
Recurring weekly schedule items. |
To ensure media is handled efficiently in production, the upload provider is swapped to Cloudinary in config/plugins.ts:
export default ({ env }) => ({
upload: {
config: {
provider: 'cloudinary',
providerOptions: {
cloud_name: env('CLOUDINARY_NAME'),
api_key: env('CLOUDINARY_KEY'),
api_secret: env('CLOUDINARY_SECRET'),
},
actionOptions: {
upload: {
folder: 'faizan-e-madina-uploads',
},
delete: {},
},
},
},
});Yusuf Qureshi Connect with me on LinkedIn to discuss this project further.