Giter VIP home page Giter VIP logo

dnb-stack's Introduction

Remix DnB Stack

The Remix DnB Stack

See it live: https://dnb-stack.vercel.app/

Learn more about Remix Stacks.

npx create-remix --template robipop22/dnb-stack

What's in the stack

Not a fan of bits of the stack? Fork it, change it, and use npx create-remix --template your/repo! Make it your own.

Development

Make sure the dependencies are installed

yarn

Afterwards, start the Remix development server like so:

yarn dev

Open up http://localhost:3000 and you should be ready to go!

Go to localhost:3000/books and you should see a list of books. This is a simple example of how to integrate a 3rd party API (tested, typed and mocked).

Precommit hooks

We use Husky to run a pre-commit hook to lint the code.

This prevents us from having to run the linters into our pipelines. It will not let you commit if you have linting errors.

The pre-commit hook will run the following commands:

yarn hook

You can move this step into a github action, or run it manually. But this method is faster for development as you won't have to wait for the hook to run in the pipeline.

Relevant code

This is a basic app that contains two routes, the index for documentation and the /books as a living example of how you can integrate a 3rd party API. The data is mocked and typed and also there is a both unit tests for the client function as well as a cypress test for the respective route.

Deployment

This stack has a github action for automated deploy on merge on the following branches: qa, dev or main.

You just need to specify and configure the subdomains of your app. Also from the settings in the repository you need to add Actions secrets so that the github action can deploy your app:

  • VERCEL_ORG_ID
  • VERCEL_PROJECT_ID
  • VERCEL_TOKEN

If you'd like to avoid using github action deploy, you can also deploy the directory by running Vercel CLI:

npm i -g vercel
vercel

GitHub Actions

We use GitHub Actions for continuous integration and deployment. Anything that gets into the main branch will be deployed to production after running tests/build/etc. Anything in the dev branch will be deployed to staging. There is a also a qa branch that is used for testing.

Testing

Cypress

We use Cypress for our End-to-End tests in this project. You'll find those in the cypress directory. As you make changes, add to an existing file or create a new file in the cypress/integration/e2e directory to test your changes.

We use @testing-library/cypress for selecting elements on the page semantically.

To run a specific test(flow) in development, run FLOW=books yarn cypress:run:flow which will start the dev server for the app as well as the Cypress client. Make sure the app is running.

By flow we want to define some user flows that we will test. For example, if we want to test the app with a user that wants to see the list of books, we can test that by running FLOW=books yarn cypress:run:flow.

This can be later extended to run multiple flows. Followed the provided example to extend this further.

Vitest

For lower level tests of utilities and individual components, we use vitest. We have DOM-specific assertion helpers via @testing-library/jest-dom.

You can run the tests with yarn test or yarn vitest:coverage to also show the coverage.

Type Checking

This project uses TypeScript. It's recommended to get TypeScript set up for your editor to get a really great in-editor experience with type checking and auto-complete. To run type checking across the whole project, run yarn lint.

Linting

This project uses ESLint for linting. That is configured in .eslintrc.js.

Formatting

We use Prettier for auto-formatting in this project. It's recommended to install an editor plugin (like the VSCode Prettier plugin) to get auto-formatting on save. There's also a yarn format script you can run to format all files in the project.

dnb-stack's People

Contributors

robipop22 avatar eric-burel avatar

Watchers

 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.