The Swiss Army Knife for Local API Servers
Transform any SQL database or file into a fully-featured API server with REST, GraphQL, gRPC, and WebSocket support — all from a single binary.
Stop writing boilerplate API servers. Whether you're prototyping a frontend, testing microservices, or building a quick backend, DatRi gets you from zero to a production-ready API in seconds.
# That's it. Your API is live.
datri serve --db mydata.dbNow access your data via:
- 🌐 REST →
http://localhost:8080/users - 📊 GraphQL →
http://localhost:8080/graphql - ⚡ gRPC →
localhost:50051 - 🔌 WebSocket →
ws://localhost:8080/ws
- 🔥 Multi-Protocol Support — REST, GraphQL, gRPC, WebSocket from one source
- 💾 SQL-First — Works with SQLite, PostgreSQL, MySQL, and more
- 📁 File Support — Serve JSON, CSV, or YAML files as APIs
- 🔐 Auth Ready — Built-in support for JWT, API keys, OAuth (coming soon)
- ⚡ Zero Config — Sensible defaults, works out of the box
- 🐳 Docker Ready — Single binary, easy to containerize
- 🔄 Hot Reload — Auto-detects schema changes
- 📖 Auto Documentation — OpenAPI/Swagger + GraphQL Playground included
# Using Go
go install github.com/koustreak/DatRi/cmd/datri@latest
# Or download binary from releases
curl -L https://github.com/koustreak/DatRi/releases/latest/download/datri-linux-amd64 -o datri
chmod +x datri1. Serve a SQLite database:
datri serve --db ./myapp.db2. Serve a JSON file:
datri serve --file ./data.json3. Connect to PostgreSQL:
datri serve --db "postgres://user:pass@localhost/mydb"# GET all users
curl http://localhost:8080/users
# GET user by ID
curl http://localhost:8080/users/1
# POST new user
curl -X POST http://localhost:8080/users \
-H "Content-Type: application/json" \
-d '{"name":"Alice","email":"alice@example.com"}'query {
users(limit: 10) {
id
name
email
}
}grpcurl -plaintext localhost:50051 datri.UserService/GetUserconst ws = new WebSocket('ws://localhost:8080/ws/users');
ws.onmessage = (event) => console.log(JSON.parse(event.data));Create a datri.yaml for advanced setups:
server:
port: 8080
protocols:
- rest
- graphql
- grpc
- websocket
database:
type: postgres
connection: "postgres://localhost/mydb"
auth:
enabled: true
type: jwt
secret: your-secret-key
cors:
enabled: true
origins: ["*"]Then run:
datri serve --config datri.yaml| Scenario | How DatRi Helps |
|---|---|
| Frontend Development | Mock backend APIs without writing server code |
| Microservices Testing | Quickly spin up test services with realistic data |
| Prototyping | Validate ideas with a real API in minutes |
| Database Exploration | Instantly expose any SQL database as an API |
| Mobile App Development | Test different API patterns (REST vs GraphQL) easily |
- REST API support
- SQL database connectors
- GraphQL support
- gRPC support
- WebSocket support
- JWT authentication
- Rate limiting
- API key management
- Custom middleware plugins
- Real-time subscriptions
- Admin dashboard
Contributions are welcome! Please see CONTRIBUTING.md for details.
MIT © Koushik
If DatRi saves you time, give it a ⭐ on GitHub!
Built with ❤️ using Go