Skip to content

jrycw/fasthtml-svcs-edgedb-mvp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fasthtml-svcs-edgedb-mvp

Description

This repository is focused on building an MVP todo app using EdgeDB, SVCS, and FastHTML.

EdgeDB schema

module default {
   type Todo {
    required title: str {
      constraint min_len_value(1);
      constraint max_len_value(50);
    };
   }

   function select_todo_by_id(tid: uuid) -> Todo
   using (
      select (assert_exists(assert_single((select Todo filter .id=tid))))
   )
}

Steps for this repo

  1. Write EdgeQL queries and generate code using edgedb-py (stick with version 1.9.0, as v2 may have compatibility issues).
  2. Set up the db_client in lifespan.py.
  3. Define the dataclass models.
  4. Implement the __ft__() method for the Todo class.
  5. Use svcs.starlette.aget() to obtain the AsyncIOClient.
  6. Execute the generated queries to fetch results.
  7. Convert the results into dataclass instances.
  8. Return the output as HTML.
  9. To get started, ensure EdgeDB is set up and then run uvicorn app.main:app --port 8000 --reload.

Refs

About

MVP: EdgeDB and FastHTML Integration with svcs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published