ApiNest is an open-source platform that transforms your JSON data into instant REST APIs. Simply upload your JSON data and get fully functional endpoints with automatic CRUD operations, documentation, and zero configuration. Perfect for rapid prototyping, lightweight data storage, or creating APIs from existing JSON files without the overhead of a full database setup.
- JSON to API: Upload your JSON data and instantly get REST endpoints with full CRUD operations
- Zero Configuration: No setup required - just paste your JSON and start using the API
- Auto Documentation: Beautiful Swagger-style API docs generated automatically
- Custom Endpoints: Get unique URLs like
/api/usersand/api/productsautomatically generated from your data - User-Namespaced Paths: Buckets are organized under usernames for easy collaboration and access control
- Authentication: Built-in API key or session-based auth for secure access
- Interactive Dashboard: Intuitive web interface built with Next.js for managing your JSON buckets
- Scalable Backend: Go-based API server with PostgreSQL for reliable persistence
- Monorepo Setup: Single repository for frontend and backend, with easy local development
Visit the ApiNest website: https://apinest.kawannabin.com.np
.
βββ frontend/ # Next.js app (landing page + dashboard)
β βββ Dockerfile # Frontend Docker configuration
β βββ ...
βββ backend/ # Go backend with PostgreSQL integration
β βββ Dockerfile # Backend Docker configuration
β βββ ...
βββ docker-compose.yml # Docker Compose configuration for full stack
βββ package.json # Monorepo configuration and scripts
βββ pnpm-lock.yaml # pnpm lockfile for dependencies
βββ pnpm-workspace.yaml # pnpm workspace definition
βββ README.md # This file
βββ LICENSE # MIT Non-Commercial License
βββ .gitignore # Git ignore rules
ApiNest is a monorepo using pnpm workspaces. You can run it either with Docker Compose (recommended) or with local development setup.
The easiest way to get started is using Docker Compose, which sets up the entire stack including PostgreSQL:
# Clone the repository
git clone https://github.com/nabinkawan/apinest.git
cd apinest
# Start all services
docker-compose up --build
# Or run in detached mode
docker-compose up --build -dThis will start:
- Frontend: Next.js app on
http://localhost:3000 - Backend: Go API server on
http://localhost:8080 - Database: PostgreSQL on
localhost:5433(mapped from internal port 5432)
The docker-compose.yml file includes:
- Health checks for the database to ensure proper startup ordering
- Service dependencies so the backend waits for the database to be ready
- Network isolation with a custom bridge network
- Volume persistence for PostgreSQL data
- Environment variables for configuration
Key environment variables:
NEXT_PUBLIC_API_URL: Frontend API endpoint (set tohttp://backend:8080for internal communication)DATABASE_URL: Backend database connection stringGIN_MODE: Go backend mode (set toreleasefor production)
For local development, ensure you have Node.js (v18+), pnpm (v8+), Go (v1.21+), and PostgreSQL installed.
For Docker-based development, you can build individual services:
# Build frontend (from project root)
docker build -f frontend/Dockerfile -t apinest-frontend .
# Build backend (from backend directory)
cd backend
docker build -t apinest-backend .
# Or use the monorepo scripts
pnpm docker:frontend # Build frontend image
pnpm docker:backend # Build backend image
pnpm docker:up # Start all services with docker-compose
pnpm docker:down # Stop all servicesTo ensure code quality and consistency, set up linting and pre-commit hooks:
-
Install pre-commit:
pip install pre-commit
-
Install Go linting tools:
# Install golangci-lint curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0 # Install goimports for Go code formatting go install golang.org/x/tools/cmd/goimports@latest
-
Set up pre-commit hooks:
pre-commit install
-
Run linting manually (if needed):
# Frontend linting pnpm --filter=frontend lint # Backend linting cd backend && pnpm lint
The pre-commit hooks will automatically run linting and formatting checks before each commit, ensuring code quality and consistency across the project.
- Make changes to your code
- Stage your changes:
git add . - Commit:
git commit -m "your message"- pre-commit hooks will run automatically - If hooks fail: Fix the issues and commit again
- Push:
git pushwhen all checks pass
-
Clone the repository:
git clone https://github.com/nabinkawan/apinest.git cd apinest -
Install dependencies:
pnpm install
-
Set up the database:
- Create a PostgreSQL database named
apinest. - Or use Docker:
docker run --name apinest-db -e POSTGRES_PASSWORD=yourpassword -p 5432:5432 -d postgres:15
- Create a PostgreSQL database named
-
Copy environment files:
cp frontend/.env.sample frontend/.env cp backend/.env.sample backend/.env
- In
frontend/.env: SetNEXT_PUBLIC_API_URL=http://localhost:8080andNEXT_PUBLIC_APP_URL=http://localhost:3000. - In
backend/.env: SetDATABASE_URL=postgres://user:pass@localhost:5432/apinest,JWT_SECRET=your-secret-key, andAPP_DOMAIN=apinest.com(for production URL generation).
- In
cd backend
go mod tidy
# Run migrations
npm run migration:up
go run main.go- Runs the Go server on
http://localhost:8080. - Supports path-based routing for endpoints like
/nabin/projects.
pnpm --filter=frontend dev- Runs Next.js on
http://localhost:3000. - Connects to the backend at the URL defined in
.env.
Run backend in one terminal and frontend in another:
# Terminal 1: Backend
cd backend && go run main.go
# Terminal 2: Frontend
pnpm --filter=frontend devOr use monorepo scripts for frontend-focused tasks:
pnpm dev # Starts frontend dev server
pnpm build # Builds frontendAccess the dashboard at http://localhost:3000 to sign up, create a bucket under your username, and test simple access (e.g., curl http://localhost:8080/yourusername/my-bucket).
The project includes GitHub Actions workflows for automated deployment:
-
Frontend Production Deploy (
.github/workflows/frontend-production-deploy.yml):- Triggers on changes to
frontend/directory - Builds and pushes Docker image to registry
- Triggers re-deployment via webhook
- Triggers on changes to
-
Backend Production Deploy (
.github/workflows/backend-production-deploy.yml):- Triggers on changes to
backend/directory - Runs tests and builds Go application
- Builds and pushes Docker image to registry
- Triggers re-deployment via webhook
- Triggers on changes to
Configure these secrets in your GitHub repository:
REGISTRY_USERNAME: Docker registry usernameREGISTRY_PASSWORD: Docker registry passwordREDEPLOY_WEBHOOK: Webhook URL for triggering deployments
Configure these variables in your GitHub repository:
REGISTRY: Docker registry URL (e.g.,docker.io)API_URL: Production API URL for frontend builds
- Sign Up/Login: Create an account via the dashboard to get your
{username}. - Upload JSON Data: Paste your JSON data into a new bucket via the dashboard or API. For example:
{ "users": [ { "id": 1, "name": "John Doe", "email": "john@example.com" }, { "id": 2, "name": "Jane Smith", "email": "jane@example.com" } ] } - Get Instant API: Your JSON data becomes a fully functional REST API:
GET /{username}/usersβ Retrieve all usersGET /{username}/users/1β Get specific userPOST /{username}/usersβ Add new userPUT /{username}/users/1β Update userDELETE /{username}/users/1β Delete user
- Auto Documentation: Visit the generated Swagger docs to test your endpoints
- Share & Collaborate: Public buckets are readable by anyone; private ones require auth
Frontend container fails with "Cannot find module 'next'":
- This is usually resolved by rebuilding the frontend image
- Run:
docker-compose build frontend --no-cache
Backend can't connect to database:
- Ensure the database container is healthy:
docker-compose ps - Check database logs:
docker-compose logs db - The backend waits for database health check before starting
Port conflicts:
- Frontend: Change port mapping in
docker-compose.yml(e.g.,"3001:3000") - Backend: Change port mapping in
docker-compose.yml(e.g.,"8081:8080") - Database: Change port mapping in
docker-compose.yml(e.g.,"5434:5432")
Build context issues:
- Frontend builds from project root:
docker build -f frontend/Dockerfile -t apinest-frontend . - Backend builds from backend directory:
cd backend && docker build -t apinest-backend .
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using Next.js, Go, and PostgreSQL.
β Star this repo if you find it useful! Questions? Open an issue.