# fartstack

Flutter and Dart full stack template, Lovingly called FartStack

Optimising for iteration speed, correctness, and deployability.

Because building a product is like a fart: You can't be sure its not crap until the follow-through.

## HowTo

Dev is done all in dart, with the flutter framework as a frontend. The backend uses [dart_frog](https://dartfrog.vgv.dev/), a dart backend
framework with a focus on developer experience. This whole stack revolves around my Dart expertise, so its not about
being blazingly fast, but the quickest stack I can build in with a statically-typed language.

### Installing

If you have the nix package manager and direnv setup, its as easy as running `direnv allow`, bingo bango.

If not, well, you need to setup `flutter`, `dart` (should get installed with flutter), and `dart_frog`

### Running

This codebase makes use of [RPS](https://pub.dev/packages/rps/install), just to standardize calling
various tools, like Make, but for dart.

- Frontend is started with `cd frontend` and `flutter run` (not included in rps because there are lots of cli flags I
change often with flutter run)
- Backend is started with `cd backend` and `rps dev` or `dart_frog dev`
- The `build_runners` (codegen) for each subproject can all be run `cd backend` and `rps watch` for development or `rps
build` for a one off codegen
  - If you dont want to bother installing rps, you can run the script directly:
```sh
dart backend/scripts/run_build_runner.dart
```

And if you dont want to run all three watchers, you can just run an individual one with
```sh
dart run build_runner watch # or other args
```

### Testing

#### Backend

End to end tests can be run with `cd backend` and `rps e2e`.

All end to end tests are located in the `backend/test_e2e/tests` folder.
There is a helper script that compiles and launches the backend and runs some end to end tests through it.

#### Frontend

:|


## Frontend `./frontend/`

WIP

## Backend `./backend/`

Uses the great [dart frog](https://dartfrog.vgv.dev/) framework. Its an file-based framework, so to create a new route on `/new_route/bingo`,
you would create a new file in `routes/new_route/bingo.dart` that contains a function
```dart
Response onRequest(RequestContext context) {
  return Response
}
```

Easy Peasy.

Go to the docks for more.

In the box, fartstack has authentication with JWT tokens setup