{"id":28707206,"url":"https://github.com/derder3010/fastapi-cms","last_synced_at":"2025-06-14T16:11:09.974Z","repository":{"id":287677820,"uuid":"965244804","full_name":"derder3010/fastapi-cms","owner":"derder3010","description":"A modern, high-performance Content Management System built with FastAPI, SQLModel, and Pydantic.","archived":false,"fork":false,"pushed_at":"2025-05-01T22:12:21.000Z","size":655,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-01T22:31:23.684Z","etag":null,"topics":["cms-backend","fastapi","jinja2-templates"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derder3010.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-12T18:20:42.000Z","updated_at":"2025-05-01T22:12:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fcaa0da-060f-4f76-b098-d7180fbaab67","html_url":"https://github.com/derder3010/fastapi-cms","commit_stats":null,"previous_names":["derder3010/fastapi-cms"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/derder3010/fastapi-cms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derder3010%2Ffastapi-cms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derder3010%2Ffastapi-cms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derder3010%2Ffastapi-cms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derder3010%2Ffastapi-cms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derder3010","download_url":"https://codeload.github.com/derder3010/fastapi-cms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derder3010%2Ffastapi-cms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259843341,"owners_count":22920313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cms-backend","fastapi","jinja2-templates"],"created_at":"2025-06-14T16:11:09.465Z","updated_at":"2025-06-14T16:11:09.965Z","avatar_url":"https://github.com/derder3010.png","language":"HTML","funding_links":["https://www.buymeacoffee.com/duytrandev","https://ko-fi.com/duytrandev"],"categories":[],"sub_categories":[],"readme":"# FastAPI CMS\n\nA modern, high-performance Content Management System built with FastAPI, SQLModel, and Pydantic.\n\n![Dashboard Preview](media/dashboard.png)\n\n\u003ca href=\"https://www.buymeacoffee.com/duytrandev\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 45px !important;width: 163px !important;\" \u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n\u003ca href=\"https://ko-fi.com/duytrandev\" target=\"_blank\"\u003e\u003cimg src=\"https://storage.ko-fi.com/cdn/kofi3.png?v=3\" alt=\"Support me on Ko-fi\" style=\"height: 45px !important;\" \u003e\u003c/a\u003e\n\n## Features\n\n- **API-first design**: RESTful API endpoints for all resources\n- **Admin Dashboard**: Intuitive web interface for content management\n- **Authentication**: JWT-based authentication system\n- **Content Management**: Articles, categories, tags, comments, and products\n- **Database**: SQLite by default, with support for PostgreSQL, MySQL, Oracle, SQL Server and many others\n- **Docker Support**: Easy deployment using Docker\n- **Responsive Design**: Mobile-friendly admin interface\n\n## Tech Stack\n\n- **FastAPI**: High-performance Python web framework\n- **SQLModel**: SQL databases in Python with type checking\n- **Pydantic**: Data validation and settings management\n- **Jinja2**: Template engine for the admin interface\n- **JWT**: JSON Web Token for authentication\n- **Alembic**: Database migration tool\n\n## Application Structure\n\n```\nfastapi-cms/\n├── alembic/           # Database migrations\n├── app/               # Main application\n│   ├── api/           # API endpoints\n│   ├── auth/          # Authentication\n│   ├── models.py      # SQLModel models\n│   ├── config.py      # Application settings\n│   ├── database.py    # Database connection\n│   ├── main.py        # Application entry point\n│   ├── routers/       # Admin panel routes\n│   └── utils/         # Utility functions\n├── media/             # User-uploaded files\n├── static/            # Static files (CSS, JS, etc.)\n├── templates/         # Jinja2 templates\n├── .env               # Environment variables\n├── .env.example       # Example environment file\n├── Dockerfile         # Docker configuration\n├── docker-entrypoint.sh # Docker entrypoint script\n├── requirements.txt   # Python dependencies\n└── alembic.ini        # Alembic configuration\n```\n\n## Models\n\n- **User**: Authentication and authorization\n- **Category**: Content categorization\n- **Article**: Main content type\n- **Comment**: User feedback on articles\n- **Tag**: Content tagging and filtering\n- **Product**: E-commerce product listings with external store links\n\n## Getting Started\n\n### Prerequisites\n\n- Python 3.10+\n- pip (Python package manager)\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/yourusername/fastapi-cms.git\n   cd fastapi-cms\n   ```\n\n2. Create a virtual environment:\n\n   ```bash\n   python -m venv .venv\n   source .venv/bin/activate  # On Windows, use: .venv\\Scripts\\activate\n   ```\n\n3. Install dependencies:\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. Create a `.env` file from the example:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n5. Initialize the database with Alembic:\n\n   ```bash\n   alembic revision --autogenerate -m \"Initial migration\"\n   alembic upgrade head\n   ```\n\n6. Run the application:\n\n   ```bash\n   fastapi dev app/main.py\n   ```\n\n7. Access the application:\n   - Admin interface: http://localhost:8000/admin\n   - API documentation: http://localhost:8000/docs\n\n### Default Admin Credentials\n\n- Username: `admin`\n- Password: `admin`\n\n\u003e ⚠️ **Important**: Change the default admin credentials in production by setting `ADMIN_USERNAME`, `ADMIN_EMAIL`, and `ADMIN_PASSWORD` in your `.env` file.\n\n## Docker Deployment\n\n1. Build the Docker image:\n\n   ```bash\n   docker build -t fastapi-cms .\n   ```\n\n2. Run the container:\n   ```bash\n   docker run -p 8000:8000 -d fastapi-cms\n   ```\n\n## API Endpoints\n\n### Authentication\n\n- `POST /admin/login`: Login to get JWT token\n- `POST /admin/logout`: Logout and invalidate token\n\n### Users\n\n- `GET /api/users/`: List all users\n- `POST /api/users/`: Create a new user\n- `GET /api/users/{user_id}`: Get user details\n- `PUT /api/users/{user_id}`: Update user details\n- `DELETE /api/users/{user_id}`: Delete a user\n\n### Categories\n\n- `GET /api/categories/`: List all categories\n- `POST /api/categories/`: Create a new category\n- `GET /api/categories/{category_id}`: Get category details\n- `PUT /api/categories/{category_id}`: Update category\n- `DELETE /api/categories/{category_id}`: Delete a category\n\n### Articles\n\n- `GET /api/articles/`: List all articles\n- `POST /api/articles/`: Create a new article\n- `GET /api/articles/{article_id}`: Get article details\n- `PUT /api/articles/{article_id}`: Update article\n- `DELETE /api/articles/{article_id}`: Delete an article\n\n#### Article Filtering and Pagination\n\nThe article listing endpoint (`GET /api/articles/`) supports filtering, sorting, and pagination with the following query parameters:\n\n- `category_id`: Filter by category ID\n- `tag_id`: Filter by tag ID\n- `author_id`: Filter by author ID\n- `published`: Filter by published status (true/false)\n- `search`: Search in title and content\n- `sort_by`: Sort by field (created_at, updated_at)\n- `sort_order`: Sort order (asc, desc)\n- `page`: Page number (default: 1)\n- `per_page`: Items per page (default: 10, max: 100)\n\nExample responses:\n\n```json\n{\n  \"items\": [\n    {\n      \"id\": 1,\n      \"title\": \"Sample Article\",\n      \"content\": \"Article content...\",\n      \"published\": true,\n      \"category\": {...},\n      \"author\": {...},\n      \"tags\": [...],\n      \"created_at\": \"2024-01-01T00:00:00\",\n      \"updated_at\": \"2024-01-01T00:00:00\"\n    }\n  ],\n  \"total\": 100,\n  \"page\": 1,\n  \"per_page\": 10,\n  \"total_pages\": 10\n}\n```\n\nExample queries:\n\n- Get published articles: `/api/articles?published=true`\n- Search articles: `/api/articles?search=python`\n- Filter by category and tag: `/api/articles?category_id=1\u0026tag_id=2`\n- Sort by creation date: `/api/articles?sort_by=created_at\u0026sort_order=desc`\n- Pagination: `/api/articles?page=2\u0026per_page=20`\n- Combined filters: `/api/articles?category_id=1\u0026published=true\u0026search=python\u0026sort_by=created_at\u0026sort_order=desc\u0026page=1\u0026per_page=10`\n\n### Comments\n\n- `GET /api/comments/`: List all comments\n- `POST /api/comments/`: Create a new comment\n- `GET /api/comments/{comment_id}`: Get comment details\n- `PUT /api/comments/{comment_id}`: Update comment\n- `DELETE /api/comments/{comment_id}`: Delete a comment\n\n### Tags\n\n- `GET /api/tags/`: List all tags\n- `POST /api/tags/`: Create a new tag\n- `GET /api/tags/{tag_id}`: Get tag details\n- `PUT /api/tags/{tag_id}`: Update tag\n- `DELETE /api/tags/{tag_id}`: Delete a tag\n\n### Products\n\n- `GET /api/products/`: List all products\n- `POST /api/products/`: Create a new product\n- `GET /api/products/{product_id}`: Get product details\n- `PUT /api/products/{product_id}`: Update product\n- `DELETE /api/products/{product_id}`: Delete a product\n\n## API Documentation\n\nThe API documentation is automatically generated using Swagger UI and available at `/docs` endpoint.\n\n## Database Support\n\nFastAPI CMS supports multiple database backends through SQLAlchemy:\n\n### Built-in Support\n\n- **SQLite**: Default, no additional packages needed\n- **PostgreSQL/CockroachDB**: Requires `psycopg2` or `psycopg2-binary` and `sqlalchemy-cockroachdb`\n- **MySQL/MariaDB**: Requires `pymysql` or `mysqlclient`\n- **Oracle**: Requires `cx_Oracle`\n- **Microsoft SQL Server**: Requires `pyodbc`\n- **Firebird**: Requires `fdb`\n\n### Extended Support (External Dialects)\n\n- **MongoDB**: Requires `pymongo`\n- **Cassandra**: Requires `cassandra-driver`\n- **IBM DB2**: Requires `ibm_db_sa`\n- **SAP HANA**: Requires `hdbcli`\n- **Snowflake**: Requires `snowflake-sqlalchemy`\n- **Amazon Redshift**: Requires `redshift_connector`\n- **Google BigQuery**: Requires `pybigquery`\n\nTo use a specific database, update the `DATABASE_URL` in your `.env` file with the appropriate connection string. See the comments in `.env.example` and `app/database.py` for connection string formats.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Support\n\nIf you find this project helpful, consider buying me a coffee!\n\n\u003ca href=\"https://www.buymeacoffee.com/duytrandev\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 45px !important;width: 163px !important;\" \u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n\u003ca href=\"https://ko-fi.com/duytrandev\" target=\"_blank\"\u003e\u003cimg src=\"https://storage.ko-fi.com/cdn/kofi3.png?v=3\" alt=\"Support me on Ko-fi\" style=\"height: 45px !important;\" \u003e\u003c/a\u003e\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderder3010%2Ffastapi-cms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderder3010%2Ffastapi-cms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderder3010%2Ffastapi-cms/lists"}