Home

Awesome

<p align="center"> <a href="https://fastschema.com"> <picture> <source height="125" media="(prefers-color-scheme: light)" srcset="https://fastschema.com/fastschema-logo-small.svg"> <img height="125" alt="FastSchema" src="https://fastschema.com/fastschema-logo-small.svg"> </picture> </a> </p> <p align="center"> <a href="https://pkg.go.dev/github.com/fastschema/fastschema#section-readme" target="_blank" rel="noopener"> <img src="https://img.shields.io/badge/go.dev-reference-blue?logo=go&logoColor=white" alt="Go.Dev reference" /> </a> <a href="https://goreportcard.com/report/github.com/fastschema/fastschema" target="_blank" rel="noopener"> <img src="https://goreportcard.com/badge/github.com/fastschema/fastschema" alt="go report card" /> </a> <a href="https://codecov.io/gh/fastschema/fastschema" target="_blank" rel="noopener"> <img src="https://codecov.io/gh/fastschema/fastschema/graph/badge.svg?token=TPU5QN6E4Z" alt="codecov" /> </a> <a href="https://github.com/fastschema/fastschema/actions" target="_blank" rel="noopener"> <img src="https://github.com/fastschema/fastschema/actions/workflows/ci.yml/badge.svg" alt="test status" /> </a> <a href="https://opensource.org/licenses/MIT" target="_blank" rel="noopener"> <img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT license" /> </a> </p>

FastSchema is a Go web framework and headless CMS for building dynamic web applications. Designed to simplify the creation and management of structured content, FastSchema automates the generation of databases and provides CRUD APIs effortlessly.

Try it out

Launch a headless CMS in seconds or utilize as a web framework.

Run the Docker Container:

docker pull ghcr.io/fastschema/fastschema:latest
docker run \
  -p 8000:8000 \
  -v ./data:/fastschema/data \
  ghcr.io/fastschema/fastschema:latest

Example output:

> APP_KEY is not set. A new key is generated and saved to /fastschema/data/.env
> Using the default sqlite db file path: /fastschema/data/fastschema.db
> Visit the following URL to setup the app: http://localhost:8000/dash/setup/?token=lUDRgoTUUNDsjCcitgGFTqwMZQPmYvlU

Now you can access to the FastSchema setup page by visiting http://localhost:8000/setup?token={token} (The setup token is displayed in the terminal).

Note: FastSchema is currently in beta and under active development. We welcome feedback, contributions, and suggestions from the community to help improve the platform and make it more robust and feature-rich.

Overview

FastSchema core features are built on top of schema, a blueprint that outlines the structure of your content. This schema acts as the foundation upon which FastSchema builds your database tables and API endpoints, streamlining the development process and allowing you to focus on creating rich, dynamic content.

<p style="text-align: center;"> <img src="https://fastschema.com/static/images/fastschema.png" alt="FastSchema Overview" /> </p>

Use Cases

Web Framework

package main

import (
	"fmt"
	"log"

	"github.com/fastschema/fastschema"
	"github.com/fastschema/fastschema/db"
	"github.com/fastschema/fastschema/fs"
)

func main() {
	app, _ := fastschema.New(&fs.Config{
		SystemSchemas: []any{Tag{}, Blog{}},
	})

	app.API().Add(fs.Post("/blogvote", func(c fs.Context, vote *Payload) (*Response, error) {
		_, err := db.Mutation[Blog](app.DB()).
			Where(db.EQ("id", vote.ID)).
			Update(c.Context(), fs.Map{
				"$expr": fs.Map{"vote": "vote + 1"},
			})

		return &Response{
			Success: err == nil,
			Message: fmt.Sprintf("Vote for %d: %v", vote.ID, err),
		}, nil
	}))

	log.Fatal(app.Start())
}

Features

Fastschema offers a comprehensive suite of features designed to streamline and simplify the process of building and managing dynamic web applications.

Documentation

For more information on how to get started with FastSchema, check out our documentation.

Roadmap

Testing

FastSchema comes with a suite of automated tests to ensure the stability and reliability of the platform.

Fastschema come with integration tests that require a database connection. You can use the following command to create DB containers.

cd tests/integration
docker compose up -d

To run the tests, execute the following command:

go test ./...

You can skip the integration tests by running tests for packages only.

./tests/test.sh ./schema

Dependencies

FastSchema is built using the Go programming language and leverages a number of open-source libraries to provide its core functionality. Some of the key dependencies include:

Contributing

We welcome contributions from the community and encourage developers to get involved in the project. Whether you're a seasoned developer or just getting started, there are plenty of ways to contribute to FastSchema.