A modern, lightweight, and self-hosted serverless framework that lets you deploy and run functions without managing servers. This is a proof of concept and not production-ready.
Try it now in your browser: Invok Online Playground
This serverless framework is a proof of concept for building, deploying, and managing serverless functions in a performant and secure way. It demonstrates:
- Serverless Core: A core runtime that handles function invocation, deployment, and lifecycle management
- Command-line Interface (CLI): A tool for creating, deploying, and managing serverless functions
- Authentication System: User management for controlled access to serverless resources
- Function Namespacing: Each user's functions are isolated in their own namespace
Unlike cloud provider offerings, this framework runs entirely on your infrastructure, giving you complete control over your environment and functions.
This project is currently in proof of concept stage. While it demonstrates the core concepts of a self-hosted serverless framework, it is not yet production-ready. Key limitations include:
- Limited runtime support (currently Go and Node.js with TypeScript)
- Basic error handling and recovery
- No production-grade monitoring or logging
- Limited scalability testing
- No production security audit
- Self-hosted: Run everything on your own infrastructure with no vendor lock-in
- Simple Developer Experience: Easy-to-use CLI for function management
- Secure by Design: JWT-based authentication and secure function isolation
- Lightweight: Optimized for performance with minimal overhead
- Function Hot-reloading: Quick iteration on your function code
- Docker-based Isolation: Each function runs in its own container for security and dependency isolation
- Multi-tenant Support: Function namespacing ensures separation between users
The fastest way to get started is to use our web-based playground: Invok Online Playground
This allows you to create, deploy, and test serverless functions directly in your browser without any setup.
For local development and deployment:
- Docker and Docker Compose
- Rust toolchain (for building the CLI)
# Clone the repository
git clone https://github.com/yourusername/serverless.git
cd serverless
# Start the Serverless Core and dependencies with Docker Compose
docker-compose up -d
# Or run directly with Cargo
cargo run -p serverless_coreDownload the latest binary for your OS/CPU from the GitHub Releases page and extract it.
chmod +x ./invok && sudo mv ./invok /usr/local/bin/invokxattr -dr com.apple.quarantine ./invok && chmod +x ./invok && sudo mv ./invok /usr/local/bin/invok- Linux (x86_64):
curl -fsSL https://github.com/alob-mtc/invok/releases/download/v0.0.1/invok-v0.0.1-x86_64-unknown-linux-gnu.tar.gz -o invok.tar.gz \
&& tar -xzf invok.tar.gz \
&& sudo mv invok /usr/local/bin/invok- macOS (Apple Silicon, arm64):
curl -fsSL https://github.com/alob-mtc/invok/releases/download/v0.0.1/invok-v0.0.1-aarch64-apple-darwin.tar.gz -o invok.tar.gz \
&& tar -xzf invok.tar.gz \
&& xattr -dr com.apple.quarantine invok || true \
&& chmod +x invok \
&& sudo mv invok /usr/local/bin/invokFrom Source:
# Build the CLI
cd cli
cargo build --release
# Optional: Move the binary to your PATH
cp target/release/invok /usr/local/bin# Register a user account
invok register --email [email protected] --password your_password
# Login
invok login --email [email protected] --password your_password
# Create a new function (defaults to Go runtime)
invok create -n hello-world
# Create a Node.js TypeScript function
invok create -n hello-typescript -r nodejs
# Deploy your function
invok deploy -n hello-world
# List your deployed functions
invok list# Show help
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest --help
# Login (auth file will be saved in current directory)
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest login -e [email protected] -p yourpassword
# Create a Go function
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest create -n my-function -r go
# Create a Node.js TypeScript function
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest create -n my-ts-function -r nodejs
# List functions
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest list
# Deploy a function
docker run --rm -v $(pwd):/app -w /app bolamigbe/invok:latest deploy -n my-functionThe Serverless Core is the heart of the serverless framework:
- Function Management: Deploys, starts, and manages function lifecycles
- Request Routing: Routes incoming requests to the appropriate function
- Authentication: Verifies user identity and permissions
- Database: Persists function metadata and user information
- Redis Cache: Tracks running function state and improves performance
- Function Namespacing: Ensures function isolation between users
The CLI offers a streamlined developer experience:
- Function Creation: Generate function templates and scaffolding
- Deployment: Package and upload functions to the Serverless Core
- Authentication: Secure user management with login/registration
- Function Listing: View all deployed functions in a clean table format
Functions run in isolated Docker containers with:
- Security Isolation: Each function runs in its own container
- Dependency Management: Functions include all their dependencies
- Runtime Support: Currently supports Go and Node.js with TypeScript
serverless_framework/
├── serverless_core/ # Core runtime engine and business logic
├── cli/ # Command-line interface tool
├── db_migrations/ # Database migrations
├── db_entities/ # Database entity definitions
├── shared_utils/ # Shared function utilities
├── assets/ # Project assets
The framework uses JWT-based authentication:
- Users register or login through the CLI
- The Serverless Core validates credentials and issues a JWT token
- The CLI stores the token locally for future requests
- Functions are deployed and managed with authenticated requests
The framework implements function namespacing to ensure isolation between different users:
- Each function is associated with a user's UUID in the database
- Functions are invoked using the URL pattern:
/invok/{user-uuid}/{function-name} - A unique database index prevents name collisions within a user's namespace
- The system validates that a user can only access and invoke their own functions
- Container names include a hash of the user's UUID for better organization
This ensures that:
- Users can create functions with the same names without conflicts
- One user cannot access or modify another user's functions
- Function isolation is maintained both in the database and at runtime
We welcome contributions to enhance this proof of concept! Here are some areas where you can make an impact:
- New Runtimes: Currently we support Go and Node.js (TypeScript), but other runtimes would be valuable additions
- Function Logs: Implementing log collection and retrieval for deployed functions
- Metrics and Monitoring: Adding performance measurement capabilities
- Testing Infrastructure: Expanding test coverage for all components
- Documentation: Improving guides and examples
- Production Readiness: Help make this proof of concept production-ready
- Clone the repository
- Install dependencies:
- Rust toolchain
- Docker and Docker Compose
- PostgreSQL and Redis (or use Docker Compose)
- Copy
.env.exampleto.envand configure your environmentmake env
- Run database migrations:
cd db_migrations cargo run - Start the Serverless Core:
cargo run -p serverless_core
- API: Built with Axum web framework for high performance
- Database: Uses SeaORM with PostgreSQL
- Cache: Redis for function state tracking
- Authentication: JWT tokens with secure validation
- Function Isolation: Docker containers with network controls
- Multi-tenancy: Function namespacing with user UUIDs
- Support for additional runtimes
- Function logs collection and viewing
- Role-based access control
- Function versioning
- Cold start optimization
- Web dashboard for function management
- Comprehensive error handling and recovery
- Production-grade monitoring and alerting
- Security audit and hardening
- Performance optimization and load testing
- CI/CD pipeline for automated testing
- More... (feel free to add to this list)
This project is licensed under the LICENSE file in the repository.
A demo function running on a self-hosted environment here: invoke-demo-home-page, see the function code here
Try out the serverless framework without installing anything using our web-based playground: Invok Playground
The playground allows you to:
- Create serverless functions directly in your browser
- Deploy functions instantly
- Test your functions with real-time execution
- Experiment with the framework's capabilities
Feel free to play around with the host here: serverless-framework-host deploy/host your own function and see it for yourself (try not to break the host-machine 😂 it's a low-resource server for demo only)
