More Suggestions
See original GitHub issueI love where this framework is going. My goal would be to be able to build a full working boilerplate based on FoalTS (with features already suggested over there), alongside a separated “client” / “native” folders containing the frontend for web / native. The latter already have great CLI tools, so i’m looking on the backend side at the moment… After following the 2 first tutorials, i would like to make some suggestions :
@foal/cli is awesome !
-
foal createapp
: would it be possible to make it like vue-cli which asks a serie of questions. For example, it could ask what user want :- which architecture (SPA or SSR)
- which folders organisation (by type or by functionality)
- REST or GraphQL
- which database (PostgreSQL/TypeORM or Mongo/Mongoose)
- if SSR, which frontend framework to “connect” (hello
foal connect ...
) - which authentication pattern (sessions/cookies or JWT/JWKS)
- which social auth(s)
- define roles (by default ‘admin’ and ‘user’)
- define permission groups
- include/ignore OpenAPI docs
- include/ignore VSCode profiles for debugging and testing
- include/ignore LoggingService
- Dockerize or not
- which CI/CD (not sure what you could ask on that one ?)
- config format (json or yml or .env) => reflect in .gitignore
- include/ignore Prettier
Then those questions should help figuring which dependencies to add, and which folder structure and config to write. The generated structure would revolve around a single api example for todolist. There are also functionalities like PasswordReset and Cloud deployment i don’t know how they could/should be integrated.
-
foal g rest-api
: maybe it would be better renamed asfoal createapi
orfoal add-api
to reflect it could potentially add new graphql apis (and not limited to ‘rest’ only) -
foal run my-script
: why separate the build ? while following the tutorial, i often forgot that step when running directlyfoal run my-script
. Is there a reason to not integrate the build directly in the run command ? -
foal deploy
based on createapp answers would be helpful -
The Simple Todo List tutorial is missing the updating part
@Patch('todos/:id')
? -
Is there a way to make the front auto-reload immediately after a server reload ? (annoying to F5 every time XD)
-
in package.json, i noticed the
migration:xxx
scripts use./node_modules/bin/typeorm
=>npx typeorm
should work ? -
move
ormconfig.json
and all thetsconfig.xxx.json
in the config folder ? This would make the global structure appear less bloated. Config folder could also have 3 folders: development, production and test, plus maybe another folder ‘database’ holding config files for orm, graphql schemas and DBs ?
… pfewww i realize now all that may look overtoomuchaskingforthemoon :S but maybe you’ll find some ideas helping for FoalTS future 🚀
Cheers !
PS: i really appreciated the explanations in both tutorials, clean and concise 👍
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (4 by maintainers)
foal createapp
Ok so we maybe could go with something like this:
(1.) Depending on the result, the CLI would add a
templates/
directory, run the commandfoal connect
and maybe install a default template engine (all Express-compatible engines will work with version 1) such as twig. If SSR, add aPageController
with some routes that use therender
function. If API (SPA, API, Mobile), add anApiController
.(1a.) If GraphQL, install
@foal/graphql
andgraphql
(3.) Install the database driver and configure
ormconfig.js
and theconfig/
files.(4.). Add signup, login and logout routes. The implementation would vary with (1.) results.
(5.) Add properties to the
User
class and create a hookAdminRequired
,RoleRequired
, etc.What do you think on this?
foal run
I think we could do even better and use a configuration key here. For example,
settings.scripts.autoBuild
. This way, we could add it to the uncommited file.env
and still be able to test our production and development environments on local host..env
CI/CD, Docker
At some point I was thinking about adding two commands:
foal g gitlab-config
to generate a.gitlab-ci.yml
file. This way, when creating a new PR on Gitlab, we would already have a complete CI pipeline working.foal g docker-config
to generate aDockerfile
. I wonder if this one wouldn’t be a bit complicated due the presence of a database.Do you find it interesting?
Update
Correct!
npx
Oh I didn’t know! Do you want to submit a PR on this? The files to update would be:
This is an old issue. Here’s the latest news on that. Some questions have already been answered previously. Others have been resolved in later versions of the framework. And some have remained unanswered.
Here is a follow-up.
Resolved (partially or fully) or answered issues:
develop
command watches and rebuilds scripts when a change is made. So there is no need to rebuild the script each time before runningfoal run
. All you need is to rundevelop
in a separate terminal at the same time.tsconfig.json
has been reduced but there are still threetsconfig
and theormconfig
at the root of the directory. Moving these files to another place (a sub-directory) generates many problems (difficulty to resolve the relative paths during compilation, configuration files not found by default by the IDEs, etc), this is why they will be kept in this place in the future.npx
(thanks for the tip!).Unresolved issues and follow-up:
createapp
command. The reason behind that is that it adds a lot of work to maintain and it’s very difficult to test. This is one of the reasons, among others, why native support for Mongoose has been dropped.foal deploy
in its commands. This responsibility will be left to the CLIs of the Cloud providers (heroku deploy
, etc).tsc
andsupervisor
which makes very difficult to add such a feature. Maybe, Foal will have a full CLI one day that handles compilation and reloading, but this won’t happen in the near future.Based on this comment, I’m going to close this issue.