{"id":22419329,"url":"https://github.com/codegasms/mint","last_synced_at":"2025-06-12T14:38:09.609Z","repository":{"id":265969558,"uuid":"863704765","full_name":"codegasms/mint","owner":"codegasms","description":"A platform to host programming contests or assignments for tech schools!","archived":false,"fork":false,"pushed_at":"2025-05-02T09:56:01.000Z","size":1237,"stargazers_count":0,"open_issues_count":20,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-02T10:52:17.685Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/codegasms.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":"2024-09-26T18:59:50.000Z","updated_at":"2025-03-13T10:34:52.000Z","dependencies_parsed_at":"2024-12-01T21:23:49.831Z","dependency_job_id":"6d772fac-7547-4c86-b7ce-8a2c226748e3","html_url":"https://github.com/codegasms/mint","commit_stats":null,"previous_names":["codegasms/mint"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codegasms/mint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegasms%2Fmint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegasms%2Fmint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegasms%2Fmint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegasms%2Fmint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codegasms","download_url":"https://codeload.github.com/codegasms/mint/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegasms%2Fmint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259483478,"owners_count":22864974,"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":[],"created_at":"2024-12-05T16:15:09.221Z","updated_at":"2025-06-12T14:38:09.597Z","avatar_url":"https://github.com/codegasms.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mint\n\nA modern platform for conducting programming contests and managing coding problems.\n\n## Development Setup\n\n### Prerequisites\n\n- Node.js 22.2.0+ and npm\n- Docker\n- [Bun](https://bun.sh) (recommended package manager)\n\n### Quick Start\n\n1. Clone the repository\n\n2. Install dependencies\n\n```bash\nbun install\n```\n\n3. Set up environment variables\n\n```bash\ncp .env.example .env\n```\n\n4. Start the database\n\n```bash\nbun pg\n```\n\n5. Run migrations and seed data\n\n```bash\nbun db:migrate\nbun db:superuser  # Create an admin user\nbun db:seed      # Add test data (optional)\n```\n\n6. Start the development server\n\n```bash\nbun dev\n```\n\nVisit `http://localhost:3000` to see the application.\n\n## Available Commands\n\n### Development\n\n```bash\nbun dev          # Start development server\nbun build        # Build for production\nbun start        # Start production server\nbun lint         # Run ESLint\nbun format       # Format code with Prettier\nbun format:check # Check code formatting\n```\n\n### Database Management\n\n#### PostgreSQL Control\n\n```bash\nbun pg           # Start PostgreSQL container\nbun pg:stop      # Stop and remove PostgreSQL container\n```\n\nConnection Details:\n\n- Host: `localhost` (from host) or `mint-postgres` (from containers)\n- Port: `5432`\n- Database: `mint`\n- Username: `postgres`\n- Password: `postgres`\n- URL: `postgres://postgres:postgres@localhost:5432/mint`\n\n#### pgAdmin (Database UI)\n\n```bash\nbun pg-admin     # Start pgAdmin web interface\nbun pg-admin:stop # Stop and remove pgAdmin container\n```\n\nAccess Details:\n\n- URL: http://localhost:5050\n- Email: `admin@admin.com`\n- Password: `admin`\n\n#### Database Operations\n\n```bash\nbun db:migrate   # Generate and apply database migrations\nbun db:seed     # Add test data to database\nbun db:clear    # Clear all data from database\nbun db:superuser # Create an admin user interactively\n```\n\n### Test Data\n\nThe seeding process creates:\n\n- Admin users (2)\n- Organizer users (3)\n- Regular users (5)\n- Organizations (3)\n- Problems per organization (2)\n- Contests per organization (2)\n- Groups per organization (2)\n\nAll test users are created with password: `password123`\n\n## Project Structure\n\n```bash\nmint/\n├── app/            # Next.js app router pages\n│   ├── api-doc/    # Swagger API documentation\n│   └── api/       # API routes\n├── components/     # React components\n├── db/            # Database schema and migrations\n├── lib/           # Utility functions and shared logic\n├── middleware/    # Request middleware (logging, metrics, error handling)\n├── public/        # Static assets\n└── scripts/       # CLI scripts for development\n```\n\n## Monitoring\n\nThe application includes built-in monitoring with Prometheus metrics:\n\n- HTTP request counts and durations\n- Active user counts\n- Database query durations\n\nMetrics are available at: `http://localhost:3000/api/metrics`\n\n### Available Metrics\n\n- `http_requests_total`: Counter of HTTP requests\n- `http_request_duration_ms`: Histogram of HTTP request durations\n- `active_users`: Gauge of currently active users\n- `db_query_duration_ms`: Histogram of database query durations\n\n### Prometheus Configuration\n\nAdd to your `prometheus.yml`:\n\n```yaml\nscrape_configs:\n  - job_name: 'mint'\n    static_configs:\n      - targets: ['localhost:3000']\n    metrics_path: '/api/metrics'\n```\n\n## Troubleshooting\n\n### Database Issues\n\n1. If containers are already running:\n\n```bash\ndocker stop mint-postgres mint-pgadmin\ndocker rm mint-postgres mint-pgadmin\n```\n\n1. If ports are in use:\n\n- Check if PostgreSQL is running locally: `sudo lsof -i :5432`\n- Check if something is using pgAdmin port: `sudo lsof -i :5050`\n\n2. To completely reset:\n\n```bash\nbun pg:stop\nbun pg-admin:stop\nbun pg\nbun pg-admin\nbun db:clear\nbun db:migrate\nbun db:seed\n```\n\n\u003e [!NOTE]\n\u003e While Bun is recommended, you can still use npm by replacing `bun` with `npm run` in all commands.\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## API Documentation\n\nThe API documentation is available at `/api-doc` when running the development server.\nIt provides:\n\n- Interactive API documentation\n- Request/response examples\n- API endpoint testing interface\n\n### Adding Documentation\n\nAdd JSDoc comments with Swagger annotations to your API routes:\n\n```typescript\n/**\n * @swagger\n * /api/your-endpoint:\n *   get:\n *     summary: Endpoint description\n *     responses:\n *       200:\n *         description: Success response\n */\n```\n\n### Environment Variables\n\nMake sure your `.env` file includes:\n\n```env\nDATABASE_URL=postgres://postgres:postgres@localhost:5432/mint\n\n# Email Configuration\nSMTP_HOST=smtp.example.com\nSMTP_PORT=587\nSMTP_SECURE=false\nSMTP_USER=your-email@example.com\nSMTP_PASSWORD=your-smtp-password\nSMTP_FROM_NAME=Mint Platform\nSMTP_FROM_EMAIL=noreply@example.com\n```\n\n#### Email Configuration Details\n\n- `SMTP_HOST`: Your SMTP server hostname (e.g., smtp.gmail.com for Gmail)\n- `SMTP_PORT`: SMTP port (usually 587 for TLS or 465 for SSL)\n- `SMTP_SECURE`: Use `true` for port 465, `false` for other ports\n- `SMTP_USER`: Your SMTP username/email\n- `SMTP_PASSWORD`: Your SMTP password or app-specific password\n- `SMTP_FROM_NAME`: Display name for sent emails\n- `SMTP_FROM_EMAIL`: Email address used as sender\n\n#### Gmail Setup\n\nIf using Gmail:\n1. Enable 2-factor authentication\n2. Generate an app password\n3. Use the app password as `SMTP_PASSWORD`\n\nExample Gmail configuration:\n```env\nSMTP_HOST=smtp.gmail.com\nSMTP_PORT=587\nSMTP_SECURE=false\nSMTP_USER=your-gmail@gmail.com\nSMTP_PASSWORD=your-app-specific-password\n```\n\n\u003c!-- test ci deploy --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegasms%2Fmint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodegasms%2Fmint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegasms%2Fmint/lists"}