create-m2-app
v2.3.0
Published
A CLI to create projects at Mile Two
Downloads
25
Readme
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-auto-graphql
(Recommended) | 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
ts-gql-prisma-codegen
| Source
Use this template when you need to leverage type safe GraphQL API's. With any GraphQL API you'll need to define your schema and operations. This template uses GraphQL Code Generator to generate your types and operations based on your schema. Simply create your schema in graphql and build your type safe resolvers to match the generated types to keep that feeling of end to end type safety.
GraphQL Yoga > The fully-featured GraphQL Server with focus on easy setup, performance and great developer experience. GraphQL CodeGen > Generate code from your GraphQL schema and operations with a simple CLI Prisma > Next-generation Node.js and TypeScript ORM Example Queries, Mutations, and even Subscriptions using the server sent events(SSE) protocol Documentation - For more on server sent events vs. web sockets refer to SSE vs. WS in the Guild Yoga Server documentation
go-gin
| Source
All our other templates are running in Node.js. When you've hit limits of Node.js and need better performance, are building a simple microservice, or just want to use GoLang, this template is for you.
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.