❄️Winter sale! Get 20% off with code WINTER at checkout
Volca Core is an Open Source Serverless API boilerplate built with Node.js / TypeScript.
With a Serverless API you only pay for the time that it takes to execute your API requests. If you have little usage, you will most likely stay within the free tier of AWS and run your infrastructure for free.
This project comes with a full CI/CD pipeline that deploys your code, runs tests and scans your code for linting errors.
Database migrations help you make gradual changes to your database schema. This boilerplate project contains GitHub Actions that automatically run any new migrations as the repository is updated.
Learn how to use Volca Core to jump start your new project.
An action is essentially the code that runs when you hit an API endpoint. Actions reside in the folder services/api/src/actions. Actions typically call services to retrieve or store data and handle the response back to the requestor. Add an action by:
Creating a file for your action, e.g. services/api/src/actions/my-actions/my-action.ts.
Define your action in this file, here you can call services and return various responses depending on what the service responds:
import { container } from 'tsyringe';import { useApiAction } from '../utils/api-action';import { StatusService } from '../../services';export const myAction = useApiAction(async () => {const statusService = container.resolve(StatusService);const status = await statusService.get();return {body,};});
A route is the actual path and the HTTP method that should invoke your action. Routes are defined in services/api/src/router.ts. Add a route by:
Importing the action in router.ts:
import { myAction } from './actions/my-actions/my-action';
Defining a new route
router.get('/status', statusAction); This will enable you to call your action by requesting GET /status.
SaaS Starter Kit and Boilerplate
© 2024 SaaS Boilerplate and Starter Kit with Node.js and React - Volca.