FastAPI-template icon indicating copy to clipboard operation
FastAPI-template copied to clipboard

Adding an admin panel option when setting up the template

Open haffi96 opened this issue 2 years ago • 7 comments

Hey 👋🏽

What are opinions on adding an option to add an admin panel/dashboard which just displays the db tables set up in the template?

The dashboard would be served separately

Thinking about options such as:

  • https://github.com/fastapi-admin/fastapi-admin (seems like the more appropriate choice but never used this)
  • https://github.com/flask-admin/flask-admin (not a massive fan of this but it's lightweight I suppose)
  • Open to other suggestions

I'd be happy to pick this up if it's a wanted feature

haffi96 avatar Oct 05 '22 14:10 haffi96

Hello, and thanks for raising an issue.

It's a cool idea, but I think it would be hard to implement. Since we can select different ORMs and Databases. Personally I haven't tried a fastapi-admin library, so I don't know if it will work for all possible configurations.

If you want to grab this issue, I'm happy to see your pull request.

s3rius avatar Oct 05 '22 14:10 s3rius

hm, thats a really good point. I was thinking along the lines of, the template can have a 'default' option (will have to be an opinionated choice by yourself) for ORM/db. This doesn't mean remove support for others, keep them but have a default option

We can then chose to either:

  1. Have the option to use admin dashboard to be before the ORM/db selection with a note saying that selecting to use an admin dashboard locks them into using the default ORM/db choice. This is obviously a bigger change
  2. Have option to select use admin dashboard later in the selection process. However, when selection ORM/db. There could be a note saying 'Use the ORM/db option if you want to also use the admin dashboard'
  3. Or lastly, see if there is way to cater for all ORM/db choices. Probably can consider this first however, seems like the more complex and least maintainable option.

wdyt? It's fine if you think this is just not a feasible feature

Also the fastapi-admin has its own ORM implementation with TortoiseORM so that's a limitation. You kind of just need to provide it a db url. But obviously this means, the user may end up having two different ORMs in the project. One for the API and Tortoise for the dashboard

The more i think about it, I'm convincing myself out of doing this feature haha

haffi96 avatar Oct 06 '22 16:10 haffi96

I had that question in mind. I don't want to restrict people choose ORMs. So we can add this option in features menu and mark it as unstable.

This feature will work just fine with tortoise ORM, but we cannot provide guarantees about how it's going to work with other ORMs. I guess it's ok to just warn people.

s3rius avatar Oct 06 '22 17:10 s3rius

May be Amis Admin? https://github.com/amisadmin/fastapi_amis_admin

alldevic avatar Jan 12 '23 13:01 alldevic

May be Amis Admin? https://github.com/amisadmin/fastapi_amis_admin

It looks nice. I'll be ready to add it next week. Or you can submit a PR. On screenshots I've seen only Chinese language. Does it support other languages?

s3rius avatar Jan 12 '23 13:01 s3rius

It support English and have l11n support. But I not found packs for others langs.

alldevic avatar Jan 12 '23 15:01 alldevic

@alldevic, thanks for researching it. English is enough.

s3rius avatar Jan 12 '23 15:01 s3rius