Skip to content

jameshsu1125/template-netlify-mern

Repository files navigation

NPM NODE React TS LESS TW ROUTER EXPRESS TS NETLIFY

Logo

Logo

Short description

Table of contents

Quick start

  • install and initialize

    • install netlify-cli globally

      $ npm install netlify-cli -g
    • install module

      $ npm i
    • create .env.local file for netlify functions development

      touch .env.local
    • .create .env.local file for vite development

      touch src/pages/.env.local
  • development

    • start vite (front-end)

      $ npm run dev
    • start netlify functions (back-end)

      $ npm run serve
    • start together ( vite + netlify functions)

      $ npm run dev:serve

      sometimes netlify-cli or vite-cli will crash

    • design your schema and types

      Edit setting/index.ts for your database schema.

  • build and deployment

    • build static pages

      $ npm run build
    • deploy on netlify

      • create Netlify site

        netlify sites:create
      • or link Netlify site id

        netlify link
      • set Netlify environment variables same as .env.local.

        Netlify set environment variables
      • deploy Netlify functions.

        $ npm run deploy

        check more detail for Netlify cli

Status

What's included

  • public folder will copy to /dist
  • src folder is reactJs entry point. default file is named as pages/index.tsx
  • netlify/functions folder for express and Netlify functions source code.
  • setting/index.ts config for schema and typescript setting.

Bugs and feature requests

  • Node version must be above v18
  • I will not maintain when this project is closed

naming conventions rules

  1. general variable - Camel Case

    ex: setStatecurrentTargetpinkBackgroundinnerText

  2. react components and class name - Pascal Case.

    ex: RegularButtonNavigationBar

  3. global variable or state - Pascal Case.

    ex: ContextLandingState

  4. Immutable variable or environment variable - Screaming Snake Case.

    ex: PAGEVITE_TITLE

  5. type - I = interface, T = type.

    ex: IPropsTResult

  6. enum options - Pascal Case + "Type".

    ex: ActionTypeAlertTypeModalType

  7. class name = Snake Case.

    ex: .button-group.button-label

naming-conventions

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

Moreover, all HTML and CSS should conform to the Code Guide, maintained by Main author.

Creators

maintainer, developer

Thanks

Thank customers and some manufacturers for their support.

Copyright and license

Code and documentation copyright 2011-2022 the authors. Code released under the MIT License.