A comprehensive feed database administration system with multi-language support, multi-tenant API key management, and MCP server integration for dairy cattle nutrition optimization.
Ration Smart Feed Library provides:
- Feed Database: Multi-country, multi-language feed database
- Diet Optimization: Dairy cattle nutrition optimization algorithms
- API Management: Multi-tenant organization and API key management
- Admin Dashboard: Modern web interface for feed and API management
- MCP Integration: Ready for AI agent integration via Model Context Protocol
ration-smart-feed-library/
βββ backend/ # Backend API (FastAPI)
β βββ app/ # Main application
β βββ routers/ # API routes
β βββ middleware/ # Auth and logging
β βββ services/ # Business logic
β βββ migrations/ # Database migrations
β βββ scripts/ # Utility scripts
β
βββ admin/ # Admin Dashboard (Next.js)
β βββ app/ # Next.js app directory
β βββ components/ # React components
β βββ lib/ # Utilities and API client
β βββ hooks/ # React hooks
β
βββ README.md # This file
- Python 3.9+
- Node.js 18+
- PostgreSQL 12+
- Railway account (for deployment)
cd backend
pip install -r requirements.txt
cp .env.example .env
# Edit .env with database credentials
python scripts/run_migrations.py
uvicorn app.main:app --reloadcd admin
npm install
cp .env.example .env.local
# Edit .env.local with API URL
npm run devThe database is hosted on Railway. Connection details are provided via DATABASE_URL environment variable.
- Multi-language feed support (
feed_translationstable) - Country language mapping (
country_languagestable) - Multi-tenant organizations (
organizations,api_keystables) - Usage tracking (
api_usagetable)
# Run all migrations
cd backend
python scripts/run_migrations.py
# Run specific migration
python scripts/run_single_migration.py migrations/001_create_new_database_schema.sqlcurl -H "Authorization: Bearer ff_live_xxxxxxxxxxxx" \
https://api.example.com/diet-recommendation-working/curl -X POST https://api.example.com/auth/login \
-H "Content-Type: application/json" \
-d '{"email_id": "user@example.com", "pin": "1234"}'POST /auth/login- Email + PIN login
GET /feeds/search- Search feedsGET /feeds/{feed_id}- Get feed details
POST /diet-recommendation-working/- Get diet recommendationPOST /diet-evaluation-working/- Evaluate existing diet
POST /admin/organizations- Create organizationPOST /admin/organizations/{org_id}/api-keys- Generate API keyGET /admin/organizations/{org_id}/api-keys- List API keys
- Ethiopia: English, Afan Oromo, Amharic
- Vietnam: English, Vietnamese
- All Countries: English (default)
- Traduora Integration: Optional translation management system
- Fallback: Uses next-intl if Traduora not configured
- Feed Translations: Stored in
feed_translationstable
- ration-smart-mcp-server - MCP server for AI agent integration
-
Create Railway Project
- Add PostgreSQL service
- Add Python service (backend)
- Add Node.js service (admin - optional)
-
Configure Environment Variables
- Railway auto-generates
DATABASE_URL - Set
ENVIRONMENT=production - Set
LOG_LEVEL=INFO
- Railway auto-generates
-
Deploy
railway up
Backend (.env)
DATABASE_URL=postgresql://user:pass@host:port/db
ENVIRONMENT=production
LOG_LEVEL=INFOAdmin (.env.local)
NEXT_PUBLIC_API_URL=https://your-backend.railway.appcd backend
uvicorn app.main:app --reloadcd admin
npm run devMIT
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
For issues and questions, please open an issue on GitHub.
Built with β€οΈ for dairy farmers worldwide