BoBeenLee / nx-react-code-sharing-starter

Monorepo Starter: Nx, React, React Native, NodeJS, NextJS, Storybook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› nx-react-code-sharing-starter

Next.js + React Native + TypeScript + Storybook starter packed with useful development features.

build CodeFactor lastUpdated

✨ Features

  • ⚑️ Next.js 13
  • βš›οΈ React 18
  • πŸ“± React Native
  • ✨ TypeScript
  • πŸ“š Storybook - Build component driven UIs faster
  • πŸ— Nx.dev - Smart, Fast and Extensible Build System
  • πŸƒ Jest β€” Configured for unit testing
  • πŸ“ˆ Absolute Import and Path Alias β€” Import components using @nx-react-code-sharing/ prefix (rename prefix)
  • πŸ‘€ Default Open Graph β€” Awesome open graph generated using og
  • πŸ“ ESLint β€” Find and fix problems in your code, also will auto sort your imports
  • πŸ’– Prettier β€” Format your code consistently
  • πŸ‘· Github Actions β€” Lint, Test your code on Master Branch, Automatic Storybook Deployment

πŸ“‚ Directory structure

root
β”œβ”€β”€ apps
β”œβ”€β”€β”€β”€ nextjs-app       # nextjs app
β”œβ”€β”€β”€β”€ rn-app           # react native app
β”œβ”€β”€β”€β”€ standalone-app   # nextjs standalone app
β”œβ”€β”€ libs
β”œβ”€β”€β”€β”€ sdk              # sdk
β”œβ”€β”€β”€β”€ features         # all of the code for a feature and putting it in one single place (ex) todo)
β”œβ”€β”€β”€β”€β”€β”€β”€ todo
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ components
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ interfaces
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ stores
β”œβ”€β”€β”€β”€ shared
β”œβ”€β”€β”€β”€β”€β”€β”€ apis          # initalize api setup, add api middleware
β”œβ”€β”€β”€β”€β”€β”€β”€ hooks         # shared hooks (ex) timer, debounce...)
β”œβ”€β”€β”€β”€β”€β”€β”€ libs          # primitive libs ex) logging, storage, analytics
β”œβ”€β”€β”€β”€β”€β”€β”€ stores        # shared state management (ex) Toast, Notification... )
β”œβ”€β”€β”€β”€β”€β”€β”€ ui-components # shared ui components, styles (ex) Button, Text... )
β”œβ”€β”€β”€β”€β”€β”€β”€ utils         # shared utils (ex) string, datetime, object, uri ...)
└── README.md

⚑️ Getting Started

1. Install dependencies

npm i --legacy-peer-deps

2. Run the development server

You can start the nextjs using this command:

npm run dev

3. Change defaults

There are some things you need to change including title, urls, favicons, etc.

Find all texts with nx-react-code-sharing, then change the package name

πŸ“š Convention

Naming Convention

  • 파일 이름 넀이밍

    • ν•˜μ΄ν”ˆ ν˜•μ‹ ex) z-index.ts, login-modal.tsx ...
  • μ»΄ν¬λ„ŒνŠΈλͺ… 넀이밍

    • ex) const LoginModal = () => { ... }
  • νŒ¨ν‚€μ§€, 폴더λͺ… λ‹¨μˆ˜or볡수 넀이밍

    • μ—¬λŸ¬νŒŒμΌμ΄ λ“€μ–΄κ°ˆκ±°κ°™λ‹€λ©΄ 볡수λͺ…μœΌλ‘œ ex) shared/styles, shared/libs ...
    • 고유 κΈ°λŠ₯을 μ˜λ―Έν•œλ‹€λ©΄ λ‹¨μˆ˜ ex) app/email, app/login ...

Commit Convention

Global Types Definition Setup

  • tsconfig.lib.json, tsconfig.app.json files μ½”λ“œλ₯Ό μ•„λž˜μ™€ 같이 μΆ”κ°€ν•©λ‹ˆλ‹€.
    • ex) libs/shared/interfaces/tsconfig.libs.json
"files": [
    "../../../types/global.d.ts", <-- depth에 따라 경둜 μœ„μΉ˜λŠ” λ‹€λ₯Ό 수 있음
],

Reference

Deployment

Dev Deployment

  • Heroku
heroku container:login

npm run nextjs-app:deploy:production

docker tag DOCKER_IMAGE_ID registry.heroku.com/nextjs-app-dev-app/web

docker push registry.heroku.com/nextjs-app-dev-app/web

heroku container:release web --app=nextjs-app-dev-app

Issue

  • rnapp μ‹€ν–‰μ‹œ μ—λŸ¬ Flipper-DoubleConversion requires CocoaPods version >= 1.9, which is not satisfied by your current version, 1.8.4
    • gem install cocoapods으둜 cocoapods μ—…λ°μ΄νŠΈ ν•˜κΈ° μœ„ν•΄μ„  rvm list -> rvm use 3.0 3.0 λ²„μ ΌμœΌλ‘œ λ§žμΆ”κ³  λ‹€μ‹œ gem install cocoapods ν•©λ‹ˆλ‹€.

Contributors


BoBeenLee

πŸ’¬ πŸ“ πŸ› πŸ’» 🎨 πŸ“– πŸ“‹ πŸ’‘ πŸ’΅ πŸ” πŸ€” πŸš‡ πŸ“¦ πŸ”Œ πŸ‘€ πŸ“’ ⚠️ πŸ”§ 🌍 βœ… πŸ“Ή

About

Monorepo Starter: Nx, React, React Native, NodeJS, NextJS, Storybook


Languages

Language:TypeScript 55.4%Language:Java 17.1%Language:JavaScript 9.5%Language:C++ 7.2%Language:Objective-C++ 3.8%Language:Objective-C 2.5%Language:Makefile 1.6%Language:Ruby 1.2%Language:CSS 0.8%Language:Starlark 0.6%Language:Dockerfile 0.4%