https://github.com/1999azzar/exposeur
Flask-based content and team management platform that allows administrators to manage news articles, categories, users, team members, and more through a unified web interface with toast notifications for user feedback.
https://github.com/1999azzar/exposeur
content-management-system website
Last synced: 5 months ago
JSON representation
Flask-based content and team management platform that allows administrators to manage news articles, categories, users, team members, and more through a unified web interface with toast notifications for user feedback.
- Host: GitHub
- URL: https://github.com/1999azzar/exposeur
- Owner: 1999AZZAR
- Created: 2025-02-21T07:55:43.000Z (over 1 year ago)
- Default Branch: beast
- Last Pushed: 2025-05-02T15:31:27.000Z (about 1 year ago)
- Last Synced: 2025-05-05T07:54:02.308Z (about 1 year ago)
- Topics: content-management-system, website
- Language: HTML
- Homepage:
- Size: 130 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Exposeur
Exposeur is a Flask-based content and team management platform that allows administrators to manage news articles, categories, users, team members, and more through a unified web interface with toast notifications for user feedback.
## Table of Contents
1. [Features](#features)
2. [Tech Stack](#tech-stack)
3. [Prerequisites](#prerequisites)
4. [Installation](#installation)
5. [Configuration](#configuration)
6. [Running the Application](#running-the-application)
7. [Project Structure](#project-structure)
8. [Key Components](#key-components)
9. [API Endpoints](#api-endpoints)
10. [Authentication & Authorization](#authentication--authorization)
11. [Styling & UI](#styling--ui)
12. [Toast Notifications](#toast-notifications)
13. [Database & Migrations](#database--migrations)
14. [Utility Scripts](#utility-scripts)
15. [Deployment](#deployment)
16. [Contributing](#contributing)
17. [License](#license)
## Features
- Comprehensive news management: create, edit, delete articles; toggle visibility; advanced search and filtering by category and tags
- Dynamic category management with drag-and-drop ordering
- Robust user management with role-based access control (SUPERUSER, ADMIN, GENERAL)
- Team member management for editorial and operational staff
- Account management with password change and account deletion capabilities
- YouTube video integration with video management features
- Contact details management system
- Comprehensive policy management (Privacy Policy, Media Guidelines, Vision/Mission)
- Real-time user feedback via toast notifications
- Secure file uploads with image validation
- RESTful API with JSON responses and CSRF protection
- Dynamic sidebar navigation based on user role
- Consistent white-card UI design across all settings pages
## Tech Stack
- Python 3.x
- Flask (Web Framework)
- Flask-Login (Authentication)
- Flask-Migrate (Database migrations)
- Flask-WTF (Form handling)
- Flask-SQLAlchemy (ORM)
- Flask-CORS (Cross-origin resource sharing)
- Jinja2 (Template engine)
- Tailwind CSS (Styling)
- JavaScript (ES6+)
- Alembic (Database migrations)
- Gunicorn (Production WSGI server)
## Prerequisites
- Python 3.8+
- pip
- SQLite (default) or configure another database via `DATABASE_URI`
## Installation
1. Create and activate virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
## Configuration
1. Copy `.env.example` to `.env` (or create `.env`).
2. Set environment variables:
```env
SECRET_KEY=your_secret_key
DATABASE_URI=sqlite:///exposeur.db
FLASK_ENV=development
```
## Running the Application
```bash
python main.py
```
Open `http://127.0.0.1:5000` in your browser.
## Project Structure
```
exposure/
├── main.py # Application entrypoint
├── models.py # SQLAlchemy models
├── routes/ # Flask route blueprints
│ ├── __init__.py # Blueprint initialization
│ ├── routes_auth.py # Authentication routes
│ ├── routes_news.py # News routes
│ ├── routes_public.py # Public routes
│ └── ... # Other routes
├── requirements.txt # Python dependencies
├── passenger_wsgi.py # Passenger WSGI entrypoint
├── static/ # Static assets
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files (toast.js, sidebar-toggle.js, etc.)
│ ├── pic/ # Static images
│ └── uploads/ # Uploaded assets
├── templates/ # Jinja2 templates
│ ├── public/ # Public-facing templates
│ ├── admin_base.html # Dynamic sidebar template (role-based navigation)
│ ├── base.html # Base template
│ └── settings/ # Admin/settings templates
│ ├── account_management.html
│ ├── categories_management.html
│ ├── users_management.html
│ ├── team_members_management.html
│ ├── youtube_management.html
│ └── ... # Other settings pages
├── instance/ # Instance folder (created by Flask)
├── helper/ # Data seeding scripts
│ ├── generate_user.py # Create test users
│ ├── add_fake_news.py # Seed news items
│ ├── add_fake_images.py # Download placeholder images
│ ├── add_videos.py # Seed YouTube videos
│ ├── add_categories.py # Create default categories
│ └── init_footer_data.py # Populate policy data
├── .env # Environment variables
└── .env.example # Example environment variables
```
## Key Components
- `main.py`: initializes Flask app, extensions, context processors, and registers blueprints.
- `models.py`: defines database models (User, News, Category, TeamMember, etc.).
- `routes/`: blueprint `main_blueprint` handles public routes and `/settings/*` CRUD operations.
- `templates/`: Jinja2 templates using Tailwind utility classes for consistent white-card UI.
- `static/js/toast.js`: global `showToast()` function for toast notifications.
## API Endpoints
- `GET /api/news` : List all news articles (supports query params: `search`, `category`, `tag`, `status`, etc.)
- `POST /api/news` : Create a new article (JSON: `title`, `content`, `category_id`, `tags`).
- `PATCH /api/news/` : Update article fields or toggle visibility via `/visibility` endpoint.
- `DELETE /api/news/` : Remove an article permanently.
- `GET /api/categories` : List all categories.
- `POST /api/categories` : Add a new category.
- `PATCH /api/categories/`: Update category name or order.
- `DELETE /api/categories/`: Delete a category.
- `GET /api/users` : List all users.
- `POST /api/users` : Create a new user (JSON: `username`, `password`, `role`).
- `PATCH /api/users//status`: Toggle user active/inactive.
- `PATCH /api/users//verify`: Toggle user verified status.
- `PATCH /api/users/` : Update user details.
- `DELETE /api/users/` : Delete a user account.
- `GET /api/team_members` : List all team members.
- `POST /api/team_members` : Add a new team member.
- `PATCH /api/team_members/`: Update member fields (name, title, order, active).
- `DELETE /api/team_members/`: Remove a team member.
## Authentication & Authorization
- Flask-Login for session management.
- Roles: `SUPERUSER`, `ADMIN`, `GENERAL` via `UserRole` enum.
- `login_required` decorator on protected views.
- `current_user.is_owner()` guard for owner-only sections like team members.
## Styling & UI
- Consistent white-card design with subtle shadows and rounded corners.
- Headings: `text-xl font-semibold text-gray-900`.
- Inputs: `w-full bg-white border-gray-300 p-2 rounded-lg focus:ring-2 focus:ring-blue-400`.
- Buttons: `w-full bg-yellow-500 text-gray-900 py-3 rounded-lg font-semibold hover:bg-yellow-400 focus:outline-none focus:ring-2 focus:ring-yellow-300`.
## Toast Notifications
- Unified notifications for all CRUD actions; uses `showToast(type, message)`.
- Flash messages from Flask are passed via `get_flashed_messages` in templates.
- **Customization**: adjust duration and position in `static/js/toast.js`:
```js
// default: duration 5000ms, position top-right
showToast('success', 'Message', { duration: 3000, position: 'bottom-left' });
```
- CSS classes available: `.toast-success`, `.toast-error`, `.toast-info`, `.toast-warning`.
## Database & Migrations
- Managed with Flask-Migrate and Alembic under the `migrations/` folder.
- Initialize/revision/upgrade:
```bash
# Set up environment
export FLASK_APP=main.py
export FLASK_ENV=development
# Initialize migrations (only once)
flask db init
# Create and apply migrations
flask db migrate -m ""
flask db upgrade
```
- Connection URI configured via `DATABASE_URI` in `.env` (defaults to SQLite).
## Utility Scripts
The `helper/` directory provides data-seeding scripts:
- `generate_user.py` : Create test users with various roles.
- `add_fake_news.py` : Seed news items using Faker library.
- `add_fake_images.py` : Download and attach placeholder images.
- `add_videos.py` : Seed YouTubeVideo entries.
- `add_categories.py` : Create default category set.
- `init_footer_data.py` : Populate PrivacyPolicy, MediaGuideline, VisiMisi, Penyangkalan, PedomanHak default data.
## Deployment
- For production, serve with Gunicorn behind a reverse proxy:
```bash
gunicorn --bind 0.0.0.0:8000 main:app
```
- Configure environment variables (`SECRET_KEY`, `DATABASE_URI`, `FLASK_ENV=production`).
- Use a process manager (systemd or Docker) to ensure uptime.
## Contributing
1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/name`).
3. Commit your changes (`git commit -m "feat: description"`).
4. Push to branch (`git push origin feature/name`).
5. Create a Pull Request.
## License
This project is licensed under the MIT License.