A CLI to create projects at Mile Two
- Getting Started
- Prerequisite
- Create a new project
- Why would I use this?
- Templates
- Full Stack Templates
- next | Source
- Tech Stack
- next-prisma-rest | Source 🔥🔥
- Tech Stack
- next-prisma-auto-graphql(Recommended) | Source 🔥🔥🔥🔥
- Tech Stack
- Benefits
- Service Only Templates
- ts-gql-prisma-codegen | Source
- go-gin | Source
- nestjs-gql-prisma | Source
- typegraphql-prisma-api | Source
- What's on the Horizon?
You need to install node version >=14.18.0 to run this CLI tool. Check your node version with:
``bash`
node -v
You can install the latest version on nodejs.org.
`bash`
npx create-m2-app
Select a template and get coding 😎
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.
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.
#### 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
- React
- Next.js
- TypeScript
- Material UI
- ESLint
- Prettier
- Jest
- React Testing Library
#### 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.
!Woah
##### 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 or useCreateUserMutation) 🔥
- Auto Generated Types from your GraphQL Schema 🔥🔥
#### 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.
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.