Skip to content

bgoonz/full-stack-react-redux

Repository files navigation

β­• Template Web

Template Web is a quick starter kit project to build a complete web app using React and Redux.

Website Netlify Status License

Template Web
Web
template.azobu.com

The complete list of all features are located at azobu-projects/template or live on template.azobu.com

Table of Contents

πŸ“¦ Repositories πŸ”

You should clone all of the required repositories:

🧱 Tech Stack πŸ”

Primary

All the frontend/web dependencies sorted by priority:

  • Git β€” Distributed version control system
    • GitHub β€” Provides hosting for software development and version control using Git
  • JavaScript β€” The primary programming language
    • Node.js β€” JavaScript runtime environment and package manager
    • npm, Yarn β€” JavaScript runtime environment and package manager
  • REST API β€” REpresentational State Transfer, architectural style for distributed hypermedia systems
  • React β€” JavaScript library for building user interfaces
    • Webpack β€” JavaScript module bundler
    • Babel β€” Transcompiler for next generation JavaScript
  • Redux β€” Predictable state container for JavaScript apps
  • React Redux β€” Official React binding for Redux
  • React Router β€” Declarative routing for React
  • React Hook Form β€” Simple React forms handling and validation
  • Connected React Router β€” Redux binding for React Router v4
  • Redux DevTools Extension β€” Tools for debugging Redux state changes
  • Redux Logger β€” Logger for Redux
  • Redux Thunk β€” Redux middleware for asynchronous actions with Thunk
  • React Helmet (Async) β€” Document head manager to enhance SEO
  • CSS-in-JS β€” Pattern which CSS is composed using JavaScript
    • Styled System β€” Style props for rapid UI development
    • xstyled β€” Consistent theme based on Styled System for styled-components and emotion
    • Emotion β€” Library designed for writing CSS styles with JavaScript
  • Google Fonts β€” Library of free licensed font families
  • Axios β€” Promise based HTTP client for the browser and Mode.js
  • React-GA β€” React Google Analytics Module
  • react-snap β€” Pre-renders a web app into static HTML
  • Sentry β€” Application monitoring and error tracking software
  • LogRocket β€” Logging and Session Replay for JavaScript Apps
  • JSON Web Token (JWT) β€” Compact URL-safe means of representing claims
    • jwt-decode β€” Library that helps decoding JWT
  • dayjs β€” Small immutable date time library alternative to Moment.js
  • React HTML Parser β€” Converts HTML strings directly into React components
  • React Lazy Load Image Component β€” React Component to lazy load images and components using a HOC
  • Draft.js β€” Rich Text Editor Framework for React
  • Serve β€” Static website serving for local development
  • ESLint β€” Pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript
    • Prettier β€” Opinionated code formatter and extension for code editor
    • Standard β€” JavaScript style guide, linter, and formatter
  • Netlify β€” All-in-one platform for automating modern web projects
  • Cloudflare β€” Enterprise-grade authoritative DNS service
  • Uniregistry β€” Retail domain name registrar

Alternative

Alternative or future dependencies:

  • Alternative of REST API:
    • GraphQL API β€” Data query and manipulation language for APIs
      • Apollo β€” Data graph platform to unify APIs, microservices, and databases with GraphQL
  • Alternative of Maps API:
    • Google Maps β€” Web mapping service developed by Google
    • Mapbox β€” Mapping platform for custom designed maps
  • D3.js β€” JavaScript library for producing dynamic, interactive data visualizations
  • Cypress β€” JavaScript end-to-end testing framework
  • Jest β€” Delightful JavaScript testing framework
  • React Testing Library β€” Very light-weight solution for testing React components
  • Sinon β€” Standalone test spies, stubs and mocks for JavaScript
  • TypeScript β€” Typed JavaScript at application-scale JavaScript
  • Redux Saga β€” Redux middleware for asynchronous actions or side effects with Saga
  • Marked.js β€” Markdown parser and compiler
  • New Relic β€” Single source of truth for infrastructure monitoring, APM agents, browser monitoring, and logging
  • Docker β€” Virtualization to deliver software in packages called containers
    • Docker Compose β€” Provides a way to document and configure all of the app service dependencies

Avoided

Never be dependencies:

  • Other non-JavaScript family languages
    • Avoid Elm, ReasonML, and others. Template Web is scope limited to JavaScript or TypeScript ecosystem. For that other matters it's better to create different repositories.
  • Other non-React libraries/frameworks
    • Avoid Preact as some of the React features and integrations are missing
    • Avoid jQuery and non-familiar ones
  • Other non-Redux state management solutions
    • Avoid Redux Toolkit as it is less flexible than plain Redux
    • Avoid MobX and non-familiar ones
  • High-level framework or wrapper for React
    • Avoid Next.js and GatsbyJS because Template Web is focused on less magic and faster build time.

Known Limitations

  • The JWT is still just an accessToken, there's no refreshToken yet. Also it should be saved in Cookie rather in localStorage.

πŸ›οΈ Application Structure πŸ”

template-web
β”œβ”€β”€ LICENSE    # License
β”œβ”€β”€ README.md  # Documentation
β”œβ”€β”€ coverage   # Test coverage files
β”œβ”€β”€ package.json    # Node.js package configuration
β”œβ”€β”€ postinstall.sh  # Script to be run after dependencies installation
β”œβ”€β”€ public
β”‚   β”œβ”€β”€ _redirects     # Setup redirect index.html for static hosting like Netlify
β”‚   β”œβ”€β”€ assets         # Various asset files
β”‚   β”œβ”€β”€ favicon.ico    # Favicon
β”‚   β”œβ”€β”€ index.html     # Primary HTML file for application root
β”‚   β”œβ”€β”€ manifest.json  # Application manifest meta data
β”‚   └── robots.txt     # Rules for search engine crawlers
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ App.js        # Primary React application configuration
β”‚   β”œβ”€β”€ App.test.js   # Test file for App.js
β”‚   β”œβ”€β”€ components    # Stateless functional components or dumb components
β”‚   β”œβ”€β”€ containers    # Stateful containers or smart components
β”‚   β”œβ”€β”€ data          # JSON data files
β”‚   β”œβ”€β”€ index.js      # Entry point for the React application
β”‚   β”œβ”€β”€ pages         # Pages for React Router
β”‚   β”œβ”€β”€ redux         # Files for Redux
β”‚   β”‚   β”œβ”€β”€ actions   # Redux actions with thunks
β”‚   β”‚   β”œβ”€β”€ reducers  # Redux reducers
β”‚   β”‚   └── store.js  # Redux store
β”‚   β”œβ”€β”€ serviceWorker.js  # Setup Service Worker
β”‚   β”œβ”€β”€ setupTests.js     # Setup Jest test suite
β”‚   β”œβ”€β”€ site.json         # Metadata for the application
β”‚   └── utils  # Various utility functions
└── yarn.lock  # Lock version of dependencies

There are various dotfiles related to environment variables, Prettier, ESLint, and Git ignore.

🏁 Getting Started πŸ”

Installation

Install dependencies using yarn:

yarn

This will automatically run postinstall.sh script which creates .env.*.local files which also can be run with yarn postinstall.

You should also install and run template-api before continuing if you want to get real data from the API.

Setup Environment

For development, edit .env.development.local file:

REACT_APP_API_URL=https://localhost:3000
REACT_APP_GOOGLE_ANALYTICS_UA=UA-xxxxxxxxx-x

For production, edit .env.production.local file:

REACT_APP_API_URL=https://api.example.com
REACT_APP_GOOGLE_ANALYTICS_UA=UA-xxxxxxxxx-x

Run

yarn dev
# or
yarn start

Access the web app on https://localhost:8000.

Lint

yarn lint

To fix basic issues:

yarn lint --fix

Test

yarn test

Watch for changes:

yarn test:watch

Generate coverage:

yarn test:coverage

Build

yarn build
yarn serve

Access the built web app on https://localhost:5000.

Deployment

  • Setup a domain on Uniregistry.
  • Setup name servers to connect the domain to Cloudflare.
  • Setup application deployment with Netlify.

Build command:

yarn build

Publish directory:

build/

Environment variables:

REACT_APP_API_URL=https://api.example.com
REACT_APP_GOOGLE_ANALYTICS_UA=UA-xxxxxxxxx-x

πŸ‘€ Authors πŸ”

🀝 Contribution πŸ”

Contributions, issues, and feature requests are welcome!

🎁 Support πŸ”

Give a ⭐️ if this project helped or inspired you!

πŸ“ License πŸ”

See LICENSE

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published