tiangolo / full-stack-flask-couchdb

Full stack, modern web application generator. Using Flask, CouchDB as database, Docker, Swagger, automatic HTTPS and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project generator for FastAPI and CouchDB

maovidal opened this issue · comments

Hi Sebastián:
I'm interested in CouchDB and I would like to have a project generator based on FastAPI.
I'm quite new to all this. However while learning from the FastAPI documentation and other sources I began to understand why this kind of project generators make so much sense.
Thank you!

Hi @MrMauro !

If you are still using this project, I suggest you check the equivalent project generators for FastAPI. FastAPI solves the same use cases in a much better way.

Because of that, this Flask-based project generator is now going to be deprecated. You are still free to use it, but it won't receive any new features, changes, or bug fixes.

Sadly there's still no FastAPI project generator based on CouchDB. I'm currently not using CouchDB for any project, and the CouchDB community is sadly not as big as the community for other databases. If you need frontend synchronization with PouchDB, you might want to check the project generator for Couchbase, as the "Sync Gateway" is compatible with CouchDB and PouchDB.

Otherwise, it might be simpler to use the project generator for PostgreSQL. I'm also planning on creating a project generator based on MongoDB as its community is very active and the documentation is very good, but that will take time. And maybe one day I end up creating a project generator for FastAPI with CouchDB, but that doesn't seem to be feasible in the near future.

On the other side, the code in all these project generators is made to be extremely modular, so you should be able to take the CouchDB parts from this one and adapt them for an app based on one of the project generators with FastAPI.

I'll close this issue now, but feel free to add more comments. 🙂

Thank you for the references @tiangolo

Even I'm pretty new on all this, I'm already using the project generator based on FastAPI and Couchbase. I've learned to write some functions based on the Cloudant library to access a CouchDB database on a different container and I've been able to generate the backend API for a new set of documents and also been able to show the results on the frontend.

I was considering to rewrite the CRUD module on the FastAPI based Project Generator to switch the database for the users, roles and items modules, while I decided to check your code here and realized that at this project generator based on Flask you don't have that CRUD module. Instead you have a more focused module called Database to interact with the _users database and other related.

I guess it will be a matter of recreating the CRUD module to take advantage of the CouchDB code you have here, because I found it nicely written and you have many considerations that I even didn't thought of.

Before I commit to that, if it happens that you have any additional pointers or references to other open source code that helps me in this direction, could you let me know please?

My idea is to implement that CRUD module in a fashion similar to the one you have in the FastAPI based project generators. Then I would be able to extend it to the user, items and other "tables".

In any case, thank you Sebastián. I have learned a lot those past two weeks. I hope to be able to share a project generator based on FastAPI and CouchDB someday in the near future.

I just want to report that I have been able to use the original CouchDB code from here in the FastAPI Project Generation version. Well, so far it is just query of a database and I haven't figured it out how to deal with users and permissions modules. But I feel more confident now. After struggling the whole day now it seems pretty easy and neat.
It seems CouchDB 3.0 will bring a new search. That is why I'm so excited about all this.
Thank you!

Indeed! The new search announcement was quite interesting! I'm glad you're being able to handle it all 💪

About recommendations, I didn't find any library that helped with models better than what I had found here, that's why I ended up implementing a lot of the things directly.

Thank you for the follow up.

Even I won't be able to work on this for the next month, I would like to post what I have done in case anyone else is interested on the this CouchDB variant based on your FastAPI/Couchbase project generator.

Besides the related CouchDB code most of the work was about updating the dependencies related to the front end (Vue2 to 3 and the VeeValidation code which is totally different now).

I have almost no experience collaborating on Github and no clue about the appropriate etiquette in cases like this, where I just have updated parts to create a variant. What should I do when I have the code ready to share? Should I create a repository following your convention name for your project generators? Or could you please create it on your repository and I just "pull" the changes over there?

Great @MrMauro ! You could create a project with Cookiecutter, probably similar to these ones. But you might want to remove the parts that are not useful for you 🤷

Then if you add a GitHub topic of fastapi it would show up in the FastAPI docs in the section for External Links and related projects.