3
1 Comment

What's your CRUD workflow?

Hey indies. So when starting a new project, a decent amount of my backend work goes towards creating the CRUD api for my models.

I was wondering how you guys approach building your CRUD apis, and how long it takes you to get from zero to /api/v1.

Feel free to elaborate on any of the following:

  • Do you spec the api beforehand using OpenAPI?
  • Do you use generators or code by hand?
  • Do you adhere to any standard spec like JSON:API?
  • Do you handle security and testing early or late?
  • Do you have a go to error response structure?
  • Are there any packages you can't live without?
posted to Icon for group Developers
Developers
on July 31, 2023
  1. 1

    Hi Mosaab, what kind of backend framework are you using? I mainly use Django with Django Rest Framework (DRF). For straightforward CRUD APIs, DRF has fast way of building the APIs.

    I personally don't spec with Open API before hand for my personal projects because I am comfortable to change them if something doesn't work. But if I am working in a team with a FE developer, I would definitely do it. At least I would map out a loose response structure and discuss with the FE dev.

    I have not used any code generators but I am interested to try them out if you have any recommendations.

    Testing, Authorization and Authentication is handled early on. Django has good extensibility when it comes to easily customizing auth.

    I do have a goto response structure, a json with "detail", "error_code" and "status". I have a little function processing all responses, and I check for exceptions in that.

    I am really dependant on Django at this point. Especially with its ORM and general ease of use. I do want to explore something like FastAPI to get a different perspective. I am also learning Golang, so that will be something I am looking forward to when it comes to implementing APIs in Go.

    What kind of application are you building?

Trending on Indie Hackers
This Week in AI: The Gap Is Getting Clearer User Avatar 49 comments 1 small portfolio change got me 10x more impressions User Avatar 28 comments AI Is Destroying the Traditional Music Business and Here’s Why. User Avatar 24 comments Fixing my sleep using public humiliation and giving away a Kindle User Avatar 21 comments A Tiny Side Project That Just Crossed 100 Users — And Somehow Feels Even More Real Now User Avatar 13 comments From 1k to 12k visits: all it took was one move. User Avatar 11 comments