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.
- 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.
- Ensure you have SurrealDB installed depending on your OS (Linux, MacOS or Windows).
- Python 3.11.x.
- Node.js > v18
- Clone the repository
git clone https://github.com/richie-omondi/fastapi-nextjs-surrealdb-starterkit.git
- 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
- Setup Surreal in Windows Powershell
2023-10-24.23-22-55.mp4
- 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
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.