Code Monkey home page Code Monkey logo

Comments (11)

Immortalin avatar Immortalin commented on April 28, 2024 10

@tiangolo right now FastAPI is still not as productive as Django Rest Framework because of the lack of user-registration/management workflow. The generator is nice but it's too tightly coupled. Would be nice to have a proper CRUD generator/admin story. You mentioned not wanting to include a ORM but without one a lot of time is wasted on shipping CRUD code, fiddling with migrations etc. If nothing, at least include Django's ORM to make life easier.

ref: https://www.reddit.com/r/Python/comments/b0zxa9/introducing_fastapi/eikicdj/

from fastapi.

jlugao avatar jlugao commented on April 28, 2024 5

Hey @tiangolo I'd be glad to start working on this. I might make a proof of concept in the following weeks, is there any specific functionality you'd be looking for?

The way I see it rendering the following input types would be enough for a POC:

  • string
  • number
  • date
  • choices(enum)
  • foreign key (with a link to the resource)

What do you think? would that help? Also, I am planning to use vuetify for this if that is ok.

from fastapi.

long2ice avatar long2ice commented on April 28, 2024 4

Recommend my admin dashboard fastapi-admin,based on fastapi and tortoise-orm and rest-admin,hope a star~😁

from fastapi.

chris-allnutt avatar chris-allnutt commented on April 28, 2024 4

I don't like the idea on an ORM being incorporated into a project like this, what makes fastapi great IMO is it's focus on doing what it does extremely well. Async python routing with strict typing, and openapi generation. The docs detail how to incorporate an ORM. It would totally be cool to see some kind of vue frontend rendered from the OpenAPI with knowledge of the Pydantic models they come from for sure.

from fastapi.

tiangolo avatar tiangolo commented on April 28, 2024 1

Thanks, yes, I've been thinking about this (I think we discussed it on Linkedin). I plan on building a Vue.js CRUD admin for OpenAPI.

It would not be tightly coupled to FastAPI, as it would be compatible with OpenAPI in general, but would be made to be easily added/pluggable as the current docs pages.

I have to first build the pieces, Vue components that render correctly data to be viewed in a "details" section (for one item), in list (for multiple items), and edition mode. And then, automatic sections based on tags. And then, I have to see how to solve handling the relationships between different models/schemas. I also have to see how to integrate it with security. I already have OAuth2 with password scheme (that's already in the project generators), but maybe that can be generalizable to other schemes.

from fastapi.

shizidushu avatar shizidushu commented on April 28, 2024 1

I am also interested at building a admin. I'd like to use fastapi, mongodb, vue and vuetify. And I want to have a RBAC authentication too. But I'am not an experienced programmer.

I need some advice / best practice about how to implement those. Especially:

  1. automatic sections based on tags
    @tiangolo Can you share your idea about how to implement it? Should I just read and parse http://127.0.0.1:8000/openapi.json by hand or is there any great npm package to do it?

  2. How to implement RBAC for FastApi?
    What represent the permission?
    For example,

    @app.put("/items/{item_id}", response_model=Item)
    async def update_item(item_id: str, item: Item):
        update_item_encoded = jsonable_encoder(item)
        items[item_id] = update_item_encoded
        return update_item_encoded

    What will be the permission name? How to identify it with code?
    Should I use FastAPI's dependency system to verify role and permission?

  3. I use mongoengine to create model and create event handlers to connect and disconnect multiple connection from the mongodb(@app.on_event("startup"), @app.on_event("shutdown")) (refer the document)
    I wish there a tutorial about how to use mongoengine with FastAPI.

@jlugao Can you share your work of crud with vue?

Edit: I make some progress to implement. Although I'm not very confident about the code I write, I just make it public here: https://github.com/shizidushu/simple-report-data-table-vuetify

from fastapi.

cjw296 avatar cjw296 commented on April 28, 2024 1

I'd suggest that https://github.com/awtkns/fastapi-crudrouter meets this need so would agree with closing the issue.

from fastapi.

jorgerpo avatar jorgerpo commented on April 28, 2024

I know TypeSystem can do form rendering

https://www.encode.io/typesystem/forms/

I wonder if this can be achieved with pydantic

from fastapi.

ccrvlh avatar ccrvlh commented on April 28, 2024

@tiangolo suggestion to close this issue. This would be pretty awesome, but probably a whole new project, and eventually not part of the FastAPI core code.

from fastapi.

tiangolo avatar tiangolo commented on April 28, 2024

Hello everyone! As several have pointed out, this would actually be an independent project. If it's just based on OpenAPI, it would be a new frontend. If it's also dependent on the database, it would also depend on a specific type of database (e.g. SQL or NoSQL) and ORM, so again, another project.

The idea is of course still valid, and some of the projects mentioned here can do a great job. But to keep issues clean, and because this would really belong in an external project(s), I'm gonna close this one now. Thanks for all the interactions and discussion!

Sorry for the long delay! 🙈 I wanted to personally address each issue and they piled up through time, but now I'm checking each one in order.

from fastapi.

github-actions avatar github-actions commented on April 28, 2024

Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs.

from fastapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.