CloudFunc is a lightweight serverless function execution platform built with Node.js, Docker, RabbitMQ, PostgreSQL, and a browser-based control panel.
It lets a user:
- register with mail ID and password
- create functions from templates or custom handler code
- invoke functions with JSON arguments
- track queued, running, completed, and failed jobs
- manage only their own functions and runs through JWT-protected APIs
- Multi-service architecture with gateway, registry, worker, and container manager
- JWT-based authentication for frontend and API access
- PostgreSQL-backed user, function, and job metadata
- RabbitMQ queue for asynchronous execution
- Docker-based isolated function execution
- Warm container reuse for faster repeated invocations
- Search-first frontend flow for registering, finding, and invoking functions
- Live result updates and recent job history in the UI
Frontend UI
|
v
Gateway (auth, frontend APIs, Docker build trigger)
|
+--> Registry (users, functions, jobs, analytics) --> PostgreSQL
|
+--> RabbitMQ queue --> Worker --> Container Manager --> Function Container
-
gateway/- serves the frontend
- handles login and registration
- signs and verifies JWT tokens
- builds Docker images for user functions
- exposes authenticated UI-facing APIs
-
registry/- stores users, functions, jobs, and analytics in PostgreSQL
- auto-creates required tables on startup
-
worker service/Worker/- consumes queued jobs from RabbitMQ
- updates job state in the registry
- retries failed executions
-
worker service/container-manager/- starts or reuses function containers
- calls the runtime runner inside the container
- cleans up idle containers
-
worker service/function-runner/- contains the runtime entrypoint used inside each generated function container
CloudFunc/
├── gateway/
│ ├── gateway.js
│ ├── runner.js
│ ├── .env
│ └── public/
├── registry/
│ ├── index.js
│ ├── db.js
│ ├── schema.sql
│ ├── .env
│ └── routes/
├── worker service/
│ ├── Worker/
│ │ ├── index.js
│ │ └── .env
│ ├── container-manager/
│ │ ├── manager.js
│ │ └── .env
│ └── function-runner/
│ └── runner.js
├── package.json
└── README.md
- Ubuntu terminal
- Node.js 18 or newer
- npm
- Docker
- RabbitMQ
- PostgreSQL
Docker Compose is optional. This project can be run using plain Docker commands.
- User logs in through the frontend
- Gateway verifies JWT and accepts function metadata + handler code
- Gateway creates a temporary build folder
- Gateway writes:
handler.js- runtime
runner.js package.jsonDockerfile
- Gateway builds a Docker image
- Gateway stores function metadata in the registry
- User searches for a function in the frontend
- Gateway verifies the function exists and belongs to the logged-in user
- Gateway creates a job in the registry
- Gateway pushes the job to RabbitMQ
- Worker picks the job
- Container manager starts or reuses a warm container
- Runner executes the handler with JSON payload
- Worker updates job result in PostgreSQL
- Frontend polls the latest job result and updates the UI
Move into the project folder:
cd "/mnt/c/Users/M K Vasudev/OneDrive/Desktop/iste/Group-A-Cloudfunc/CloudFunc"Install dependencies:
npm installThis README uses PostgreSQL on host port 5433.
- database:
cloudfunc - username:
postgres - password:
postgres
Run:
docker run -d \
--name cloudfunc-postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_DB=cloudfunc \
-p 5433:5432 \
postgres:16Run:
docker run -d \
--name cloudfunc-rabbitmq \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:3-managementRabbitMQ dashboard:
http://localhost:15672
Login:
guest / guest
Each service loads its own .env file directly, so create the files in the exact folders shown below.
PORT=8080
REGISTRY_URL=http://localhost:3000
RABBITMQ_URL=amqp://localhost
JWT_SECRET=change-this-to-a-long-random-secret
JWT_TTL_HOURS=12REGISTRY_PORT=3000
POSTGRES_HOST=localhost
POSTGRES_PORT=5433
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=cloudfuncRABBITMQ_URL=amqp://localhost:5672
REGISTRY_URL=http://localhost:3000
CONTAINER_URL=http://localhost:4001PORT=4001
REGISTRY_URL=http://localhost:3000From the project root:
npm startThis starts:
- Gateway on
http://localhost:8080 - Registry on
http://localhost:3000 - Container Manager on
http://localhost:4001 - Worker service in the background
Go to:
http://localhost:8080
Recommended demo flow:
- Register a new account
- Log in
- Register a function using a starter template or custom code
- Search for the function in the invoke panel
- Provide JSON arguments
- Run the function
- View updated result and job history
- Registration and login happen through the gateway
- Gateway signs JWTs
- Frontend stores the token in local storage
- Authenticated frontend APIs automatically send
Authorization: Bearer <token> - Users only see and manage their own functions and jobs by default
POST /auth/registerPOST /auth/loginGET /auth/me
GET /api/dashboardGET /api/templatesGET /api/functionsGET /api/functions/:namePOST /api/functionsDELETE /api/functions/:namePOST /api/invokeGET /api/jobsGET /api/jobs/:jobId
POST /registerPOST /invokeGET /jobs/:jobId
- The registry creates the required schema automatically on startup.
- Docker must remain available because user functions are built and executed as containers.
- Function image names are normalized to Docker-safe lowercase names during build.
- Function deletion removes metadata from the registry, but it does not currently remove built Docker images.
- The frontend is intentionally focused on the logged-in user’s workspace and recent activity.
Check:
- PostgreSQL container is running
registry/.envmatches the actual Postgres host, port, username, password, and database
Useful command:
docker logs cloudfunc-postgresThis usually means:
- wrong password in
registry/.env - wrong host port
- connecting to a different PostgreSQL instance than expected
Check:
- Docker daemon is running
- function name is valid
- Docker has permission to build images
Check that all services are running:
- gateway on
8080 - registry on
3000 - container manager on
4001 - RabbitMQ on
5672 - PostgreSQL on configured port
Check running containers:
docker psCheck PostgreSQL logs:
docker logs cloudfunc-postgresCheck RabbitMQ logs:
docker logs cloudfunc-rabbitmqStop containers:
docker stop cloudfunc-postgres cloudfunc-rabbitmqRemove containers:
docker rm cloudfunc-postgres cloudfunc-rabbitmqCloudFunc demonstrates:
- backend service decomposition
- authenticated API design
- async job processing with RabbitMQ
- Docker-based function execution
- PostgreSQL schema and query design
- user-focused frontend workflow for cloud function management
It is a strong foundation for extending into a more production-ready platform with:
- execution logs
- richer observability
- test coverage
- Docker Compose deployment
- resource limits and sandbox hardening