AI-powered code security analysis for GitHub repositories with automated vulnerability detection.
- Real-time security analysis on pull requests
- AI-powered vulnerability detection using DeepSeek
- GitHub App integration with webhooks
- Comprehensive security reports
- Automated code review comments
- FastAPI: Modern Python web framework
- PostgreSQL: Primary database
- Redis: Caching and job queue
- OpenAI-compatible DeepSeek: AI analysis engine
- Prisma: Canonical PostgreSQL schema and migration workflow
- GitHub API: Repository integration
- Python 3.11+
- PostgreSQL 14+
- Redis 6+
- GitHub App credentials
- OpenAI-compatible DeepSeek API key
- Clone the repository:
git clone <repository-url>
cd CodeSentinel_AI- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env with your credentials- Generate Prisma client and apply the database schema:
npm install
npx prisma generate
npx prisma db push- Start the application:
uvicorn app.main:app --reloadSee .env.example for required configuration.
CodeSentinel sends OTP, welcome, and billing emails through SMTP. Brevo is the recommended production provider.
Brevo SMTP settings:
SMTP_HOST=smtp-relay.brevo.com
SMTP_PORT=587
SMTP_USERNAME=your-brevo-smtp-login
SMTP_PASSWORD=your-brevo-smtp-key
SMTP_USE_TLS=True
SMTP_USE_SSL=False
EMAIL_FROM_ADDRESS=no-reply@yourdomain.com
EMAIL_FROM_NAME=CodeSentinel AIBefore sending production email, make sure you:
- Authenticate your sending domain in Brevo.
- Create and verify the transactional sender address you want to use in
EMAIL_FROM_ADDRESS. - Use your Brevo SMTP login and SMTP key, not your Brevo account password or API key.
You can send a live SMTP test email with:
node scripts/send_test_email.js recipient@example.com- Canonical schema source:
prisma/schema.prisma. scripts/init_db.pyandscripts/init_db_standalone.pyare bootstrap helpers, not authoritative schema definitions.- Schema changes should be made in Prisma schema first.
- For production releases, create and review Prisma migrations, then run
npx prisma migrate deployduring deployment. Usenpx prisma db pushonly for local/bootstrap environments.
Once running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
app/
├── api/ # API routes and endpoints
├── core/ # Security and logging
├── db/ # Database configuration
├── models/ # SQLAlchemy models
├── schemas/ # Pydantic schemas
├── services/ # Business logic
├── agents/ # AI analysis agents
├── webhooks/ # GitHub webhook handlers
├── github/ # GitHub API integration
└── utils/ # Utility functions
Run tests:
pytestRun with coverage:
pytest --cov=app tests/docker-compose up -dMIT