Giter Site home page Giter Site logo

xmyoot / dart-shelf-realworld-example-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcusmonteirodesouza/dart-shelf-realworld-example-app

1.0 0.0 0.0 197 KB

Dart backend implementation for RealWorld

Home Page: https://realworld.io

License: MIT License

Shell 0.55% Dart 94.78% HCL 4.38% Dockerfile 0.29%

dart-shelf-realworld-example-app's Introduction

RealWorld Example App

Dart codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API.

This codebase was created to demonstrate a fully fledged backend application built with Dart including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Dart community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

This is a monolithic application structured by components. It uses:

  • PostgreSQL as the database, and uses some of it's specific features such as Arrays.
  • SQL instead of an ORM. See for example.
  • Docker Compose to run tests and the application locally. For the testing strategy, I opted to not use mocks and the such to unit test individual functions: instead, I applied a honeycomb testing strategy to run the tests against the actual app connected with an actual database. I felt that this:
    • Gave me more confidence that the application is working correctly.
    • Allowed me to refactor more easily as I test only the public interface and not the implementation details. This talk by Dan Abramov, for example, illustrates very well the importance of this.
  • Github Actions to run tests on Pull Requests and Merges to the master branch.

Getting started

Install the Dart SDK.

Running the App

Define the environment variables

Create a .env file according to the template.

Run the app

$ ./dev.sh

Running the tests

Run the test script

$ ./test.sh

Deployment

Deploy to Google Cloud Platform (GCP)

  1. Install terraform.
  2. Install the gcloud CLI.
  3. Login with gcloud.
  4. Go to the dev bootstrap directory, change the locals.tf values to your own and run terraform apply.
  5. Go the scripts directory and run build-and-push-container-image.sh <YOUR_PROJECT_ID> <YOUR_ARTIFACT_REPOSITORY>.
  6. Go to the dev directory, change the locals.tf values to your own and run terraform apply.

dart-shelf-realworld-example-app's People

Contributors

ericsimons avatar marcusmonteirodesouza avatar geromegrignon avatar alonski avatar esakkiraj avatar optikfluffel avatar segmentationfaulter avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.