- Getting Started
Getting Started
Prerequisite
You need to install node version >=14.18.0
to run this CLI tool. Check your node version with:
node -v
You can install the latest version on nodejs.org.
Create a new project
npx create-m2-app
Select a template and get coding
Why would I use this?
If you're familiar with the templates and enjoy the starting point given by the Mile Two team, using this CLI gives you added functionality such as next-auth credential login, ability to switch database setup from SQLite to Postgres, and control over starting UI and DB ports. Most of us require one of those extra configurations and this CLI will save you time automating things that can take hours like setting up and freeing up ports for your docker setup for example.
Templates
Aiming to cut down on the start time, we've templated out a few of our favorite tools and frameworks. At Mile Two we mostly use React projects and Node.js backend with Postgres databases. The templates below should reflect those configurations to include standard sets of tools we use such as TypeScript and Material-UI.
Full Stack Templates
next
| Source
Next is for the quick prototype that can run independent of an API. You can get away with using mock data for the forseeable future and don't want to lock yourself into a API specification (ex. REST vs. GraphQL)
Tech Stack
next-prisma-rest
| Source 🔥 🔥
Next Prisma REST is for the developer that wants to build out REST endpoints using a sophisticated and TypeScript friendly ORM known as Prisma.
Tech Stack
- Everything from the
next
template - Prisma
- SWR
- React Hook Form
next-prisma-graphql
| Source 🔥 🔥 🔥 🔥
Next Prisma GraphQL is for the developer that wants to leverage some of the GraphQL perks in their application with a completely auto-generated GraphQL API out of the box based on your Prisma schema.
Tech Stack
- Everything from the
next
template - Prisma
- GraphQL
- Apollo Client
- React Hook Form
- Apollo Micro Server
- Type GraphQL Prisma
- GraphQL Code Generator
Benefits
- Auto Generated CRUD operations
😭 🤯 - Auto Generated Hooks (
useUserQuery
oruseCreateUserMutation
)🔥 - Auto Generated Types from your GraphQL Schema
🔥 🔥
Service Only Templates
nestjs-gql-prisma
| Source
Nest.js is a service based template for those that are building out micro-services.
typegraphql-prisma-api
| Source
This template is for creating an Apollo server typegraphql project that uses Prisma. In addition, this template utilizes the Typegraphql Prisma generator.
What's on the Horizon?
As of now this CLI tool is being used internal and by a few open source developers. Feel free to leave feedback on any of the templates used on the github issues so we can continue to improve.