/fastapi-nextjs-surrealdb-starterkit

This repo contains a starter kit to build applications using NextJS, FastAPI and SurrealDB

Primary LanguageJavaScript

Starter kit for NextJS + FastAPI + SurrealDB App

This repo provides a starter kit for building applications with NextJS + FastAPI with SurrealDB. It sets up the frontend and backend of building a simple CRUD Todo App with SurrealDB as the database.

Frontend Preview

Frontend Image

Technologies Used

  • FastAPI - Design and build REST APIs for your application in Python.
  • NextJS - A React framework, used to create interactive and dynamic user interfaces.
  • Tailwind: A CSS framework used to style applications.
  • SurrealDB - A multi-model cloud database providing the traditional database/backend layer for our database operations which you can connect your backend to.

This starter kit implements the following endpoints:

  • POST '/addTodo' - create new Todo task and store it in the SurrealDB database.
  • GET '/mytodos' - fetches all Todo tasks from the SurrealDB database.
  • GET '/' - Returns to home/root URL.
  • POST '/editTodo' - update/edit a Todo task.
  • POST '/deleteTodo' - deletes a Todo task from the SurrealDB database.

Requirements

Getting Started

  1. Clone the repository
git clone https://github.com/richie-omondi/fastapi-nextjs-surrealdb-starterkit.git
  1. Setup the backend.

Go into to the /backend directory and follow the instructions in the README to set up the Surreal database client, install all the required dependencies, and start the FastAPI server.

2023-10-24.23-25-46.mp4
  1. Setup Surreal in Windows Powershell
2023-10-24.23-22-55.mp4
  1. Setup the frontend.

Go into the /client directory and follow the instructions in the README to setup a Next.js project using npm install then run the development server using npm run dev.

2023-10-24.23-27-21.mp4

Contributing

If you find any issues or have suggestions for improvements, please feel free to open an issue or create a pull request. Our next priority is to set up middleware for authentication and authorization.

Steps to Contribute

  • Clone this repo - git clone https://github.com/richie-omondi/fastapi-nextjs-surrealdb-starterkit.git
  • Follow the Backend Setup from here
  • Follow the Frontend Setup from here