Skip to main content

Command Palette

Search for a command to run...

πŸš€ Building a Fullstack App with dart_frog and Flutter in a Monorepo - Part 1

Creating a Full-Stack application with dart_frog and Flutter in a Monorepo Setup: Part-1

Updated
β€’3 min read
πŸš€ Building a Fullstack App with dart_frog and Flutter in a Monorepo - Part 1
S
I build mobile and full-stack apps for startups β€” React Native, Flutter, Expo, TypeScript, Express, Hono, PostgreSQL. I use Claude Code and Codex daily. Writing about what I actually run into.

πŸ’‘ Introduction

This tutorial will create a full-stack to-do application using Dart and Flutter in a monorepo setup.

A monorepo is a version control repository containing multiple projects with common code.

This allows for easier management and collaboration on projects within a single repository. We will share a common code between the frontend and backend of our to-do application, like interfaces, data models e.t.c.

The application's backend will be built using dart_frog, while the front end will be developed using Flutter.

This tutorial teaches you how to:

  • 🧰 Set up a monorepo

  • πŸ’» Create a full-stack Dart Flutter application

  • πŸ”— Manage and share common code between front-end and back end

  • πŸ“ Build a to-do application with CRUD functionality

  • 🏁 Complete the tutorial with a functional to-do application

Let's Go! πŸš€

Before we can build our full-stack to-do application, we must set up the necessary tools and dependencies. First, we will install melos.

Setup melos πŸ› οΈ

Melos is a library that will be used to set up and manage monorepo projects.

To install melos, open a terminal and run the following command:

dart pub global activate melos

This command will install Melos globally, allowing us to use it in any project.

Create a melos.yaml file and add the below content to set up our full-stack to-do application.

name: full_stack_todo_dart
packages:
  - /**/pubspec.yaml

The packages field defines the packages that are part of the monorepo. In this case, we are using the /**/pubspec.yaml pattern, which tells Melos to search for all pubspec.yaml files in the project and consider them as packages.

Hopping into backend with dart_frog 🐸

To handle the server-side logic of our full-stack to-do application, we will use a library called dart_frog.

dart_frog is a lightweight web framework for Dart that makes it easy to build server-side applications.

To install dart_frog, open a terminal and run the following command:

dart pub global activate dart_frog_cli

To create a new dart_frog project, open a terminal and navigate to the directory where you want to create the project. Then, run the following command:

dart_frog create backend

The command "dart_frog" creates a new project with necessary files and directories and adds the dependency "dart_frog" to the project's "pubspec.yaml" file.

Once you have created a new dart_frog project and set up the backend of your full-stack to-do application, you can add a Melos script to run the server. To do this, open the melos.yaml file in the root directory of your project and add the following content:

scripts:
  backend:dev:
    run: melos exec -c 1 --fail-fast -- "dart_frog dev"
    description: Starts the dev server for the backend
    select-package:
      flutter: false

Once these steps have been completed, you can run the backend:dev script by opening a terminal and navigating to the root directory of your project. Then, run the following command melos run backend:dev

This will start the dev server for the backend of your to-do application. You can then start building the server-side logic of your application using dart_frog.

βœ“ Running on http://localhost:8080 (0.1s)

If you see an output similar to the one above after running the melos run backend:dev command means that the dev server for the backend of your full-stack to-do application has been successfully started.

If you open http://localhost:8080, you should be greeted with Welcome to Dart Frog!

Stay tuned for part-2 ...

M

amazing , thanks to share all this information...

1
S

Thanks a lot, please forward, share and repost!

J

Can I have the complete tutorial in pdf format?

1
S

I think you can use some online tools to convert to PDF...

S
Ska Lee3y ago

Thank you for the good article I refer to it a lot.

I have a question when running server with 'backend:dev'

How can I see Server logs in Vscode terminal or Debug Console?

1
S

Thanks, I hope you are liking it so far, for running the debugger, what you can do is run melos run backend:dev. This will start the debugger, and you will get a URL for Dart DevTools debugger. You can copy this link, and from command pannel in your VS Code, search for Attach to Dart Process and paste that link there.

The link will look something like this.

The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/GVAVjhCO-Q8=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FGVAVjhCO-Q8%3D%2Fws

10

πŸš€ Building a Fullstack App with dart_frog and Flutter in a Monorepo

Part 1 of 6

Get started building a full-stack to-do app with Flutter and a Postgres database. Follow this tutorial series to learn how to create a full-stack app with Flutter, dart_frog and melos in a monorepo.

Up next

πŸš€ Building a Fullstack App with dart_frog and Flutter in a Monorepo - Part 2

Setting up models, repositories, data sources, failures and exceptions as a separate dart package.

More from this blog

M

Maximize Your Flutter and Dart Fullstack Skills with These Essential Tips

10 posts

I'm a full-stack developer passionate about Flutter, Dart, and Firebase. I share my knowledge and experience through this blog to help developers stay up-to-date with the latest tips and techniques.