# Discours.io Core ๐Ÿš€ **Modern community platform** with GraphQL API, RBAC system, and comprehensive testing infrastructure. ## ๐ŸŽฏ Features - **๐Ÿ” Authentication**: JWT + OAuth (Google, GitHub, Facebook) - **๐Ÿ˜๏ธ Communities**: Full community management with roles and permissions - **๐Ÿ”’ RBAC System**: Role-based access control with inheritance - **๐ŸŒ GraphQL API**: Modern API with comprehensive schema - **๐Ÿงช Testing**: Complete test suite with E2E automation - **๐Ÿš€ CI/CD**: Automated testing and deployment pipeline ## ๐Ÿš€ Quick Start ### Prerequisites - Python 3.11+ - Node.js 18+ - Redis - uv (Python package manager) ### Installation ```bash # Clone repository git clone cd core # Install Python dependencies uv sync --group dev # Install Node.js dependencies cd panel npm ci cd .. # Setup environment cp .env.example .env # Edit .env with your configuration ``` ### Development ```bash # Start backend server uv run python dev.py # Start frontend (in another terminal) cd panel npm run dev ``` ## ๐Ÿงช Testing ### Run All Tests ```bash uv run pytest tests/ -v ``` ### Test Categories #### Run only unit tests ```bash uv run pytest tests/ -m "not e2e" -v ``` #### Run only integration tests ```bash uv run pytest tests/ -m "integration" -v ``` #### Run only e2e tests ```bash uv run pytest tests/ -m "e2e" -v ``` #### Run browser tests ```bash uv run pytest tests/ -m "browser" -v ``` #### Run API tests ```bash uv run pytest tests/ -m "api" -v ``` #### Skip slow tests ```bash uv run pytest tests/ -m "not slow" -v ``` #### Run tests with specific markers ```bash uv run pytest tests/ -m "db and not slow" -v ``` ### Test Markers - `unit` - Unit tests (fast) - `integration` - Integration tests - `e2e` - End-to-end tests - `browser` - Browser automation tests - `api` - API-based tests - `db` - Database tests - `redis` - Redis tests - `auth` - Authentication tests - `slow` - Slow tests (can be skipped) ### E2E Testing E2E tests automatically start backend and frontend servers: - Backend: `http://localhost:8000` - Frontend: `http://localhost:3000` ## ๐Ÿš€ CI/CD Pipeline ### GitHub Actions Workflow The project includes a comprehensive CI/CD pipeline that: 1. **๐Ÿงช Testing Phase** - Matrix testing across Python 3.11, 3.12, 3.13 - Unit, integration, and E2E tests - Code coverage reporting - Linting and type checking 2. **๐Ÿš€ Deployment Phase** - **Staging**: Automatic deployment on `dev` branch - **Production**: Automatic deployment on `main` branch - Dokku integration for seamless deployments ### Local CI Testing Test the CI pipeline locally: ```bash # Run local CI simulation chmod +x scripts/test-ci-local.sh ./scripts/test-ci-local.sh ``` ### CI Server Management The `./ci-server.py` script manages servers for CI: ```bash # Start servers in CI mode CI_MODE=true python3 ./ci-server.py ``` ## ๐Ÿ“Š Project Structure ``` core/ โ”œโ”€โ”€ auth/ # Authentication system โ”œโ”€โ”€ orm/ # Database models โ”œโ”€โ”€ resolvers/ # GraphQL resolvers โ”œโ”€โ”€ services/ # Business logic โ”œโ”€โ”€ panel/ # Frontend (SolidJS) โ”œโ”€โ”€ tests/ # Test suite โ”œโ”€โ”€ scripts/ # CI/CD scripts โ””โ”€โ”€ docs/ # Documentation ``` ## ๐Ÿ”ง Configuration ### Environment Variables - `DATABASE_URL` - Database connection string - `REDIS_URL` - Redis connection string - `JWT_SECRET` - JWT signing secret - `OAUTH_*` - OAuth provider credentials ### Database - **Development**: SQLite (default) - **Production**: PostgreSQL - **Testing**: In-memory SQLite ## ๐Ÿ“š Documentation - [API Documentation](docs/api.md) - [Authentication](docs/auth.md) - [RBAC System](docs/rbac-system.md) - [Testing Guide](docs/testing.md) - [Deployment](docs/deployment.md) ## ๐Ÿค Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Add tests for new functionality 5. Ensure all tests pass 6. Submit a pull request ### Development Workflow ```bash # Create feature branch git checkout -b feature/your-feature # Make changes and test uv run pytest tests/ -v # Commit changes git commit -m "feat: add your feature" # Push and create PR git push origin feature/your-feature ``` ## ๐Ÿ“ˆ Status ![Tests](https://github.com/your-org/discours-core/workflows/Tests/badge.svg) ![Coverage](https://codecov.io/gh/your-org/discours-core/branch/main/graph/badge.svg) ![Python](https://img.shields.io/badge/python-3.11%2B-blue) ![Node.js](https://img.shields.io/badge/node-18%2B-green) ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.