Git Product home page Git Product logo

Comments (5)

omrihar avatar omrihar commented on May 13, 2024 2

I'm also spending some time thinking about the best layout, and I have been thinking along similar lines. It could make it much easier to add more resources. A different approach we're looking into is using a template to generate all these files in their respective directories. But the templating approach would work in either case.

from full-stack-fastapi-template.

dmontagu avatar dmontagu commented on May 13, 2024 1

I agree with this point -- I think the current organization makes it harder to build composable units of functionality (e.g., an auth system) that can be reused since you need to grab files from many places. (But maybe that's more of an issue of not being more intentional about it at the outset.)

I'm not sure what the ideal organization is -- you'd probably still want a place to put endpoints, etc., that touch multiple resources. But I think this point is definitely worth considering.

from full-stack-fastapi-template.

tiangolo avatar tiangolo commented on May 13, 2024 1

Thanks for the discussion here!

Yeah, for some cases where sections are clearly separated it would probably be better to have them separated by the specific feature/resource.

But there are also many use cases that require references across different parts of the application, for example "add user John's note to the board X", should the crud utils for that live under "notes", "boards", "users"?

And if another of the components needs to access the same utils, would it import them from that external component? How would one decide on which component to put that logic, so that when other team members come looking for that, they also find it instead of re-implementing it in the other component?

Of course, there are many use cases that would benefit from your proposed structure, and the current one wouldn't be ideal for them, but it would probably still "work". Nevertheless, the new structure would probably make some use cases more cumbersome.

That's also why I've tried to keep this project relatively simple so that you can remove entire sections easily and add your preferred style. That's also why I haven't made any of the code in this project available as a third-party package or similar, because I don't think it's the "best" solution, or that it would apply for all the use cases, but it's a somewhat acceptable starting point 🤷 😅

In fact, I think I would like to simplify some parts of this project, to make it easier to discard and/or refactor entire sections, to simplify the Docker Compose files, even if that means some duplication, etc.

from full-stack-fastapi-template.

dmontagu avatar dmontagu commented on May 13, 2024

Yeah, it would be nice to be able to easily generate resources in a modularity-oriented set of files. On that note, I would be especially interested in something that could generate pydantic and sqlalchemy models together! Or at least, an XCreate and XInDB model from a sqlalchemy model X (default behavior: all fields optional on the Create, all fields required on the InDB).

from full-stack-fastapi-template.

github-actions avatar github-actions commented on May 13, 2024

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

from full-stack-fastapi-template.

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.