Git Product home page Git Product logo

boilerplatereact's Introduction

Template Frontend CSR (React + Vite)

React badge React Router badge I18next badge Sass badge
Vite badge Typescript badge ESLint badge Formik badge Yup badge Sweetalert badge

This template is made in Typescript, React for UI, i18n for the locales, Formik for the logic in forms and Yup for validations, with Sweetalert and React Router, SASS for the styles and Vite for the bundle

Scripts:

  • pnpm install to install all dependencies
  • pnpm start for development mode and start with the creation of a new universe
  • pnpm build to build the project
  • pnpm preview to preview the bundle

Environment variables

To use environment variables copy the file .env.example two times and rename one as .env.development.local and the other as .env.production.local, the first is for development mode and the second for production mode.

Note:

  • Never put values in .env.example
  • Use PUB_ prefix to render in client

Alias

Name Description Example
@components All components on src/components/index.ts import { Header } from "@components";
@containers All containers on src/containers/index.ts import { SigninForm } from "@containers";
@context All contexts on src/context/index.ts import { AppProvider } from "@context";
@hooks All custom hooks on src/hooks/index.ts import { useModal } from "@hooks";
@hoc All custom hoc(higher-order component) on src/hoc/index.ts import { withAuth } from "@hoc";
@pages All pages on src/pages/* const Home = lazy(() => import("@pages/Home")); or import Home from "@pages/Home";
@utils All functions on src/common/utils.ts import { PaymentError } from "@utils"
@typing All typing on src/common/typing/* import { SigninValues } from "@typing"
@config Global config on src/common/config.ts import config from "@config";
@schemas All schemas for formik on src/common/schemas/index.ts import { SigninSchema } from "@schemas";
@services All services for connections on src/common/services/index.ts import { signin } from "@services";
@cstyles All styles for components on src/styles/components/* import "@cstyles/Header.scss";
@stylesPages All styles for pages on src/styles/pages/* import "@pstyles/Home.scss";
@styles Globals styles on src/styles/Globals.scss import "@styles";
@images All images on src/assets/images/* import Background from "@images/background.png";
@icons All icons on src/assets/images/icons/* import Logo from "@icons/logo.svg";
@videos All videos on src/assets/videos/* import Video from "@videos/video.mp4";
@fonts All fonts on src/assets/fonts/* url("@fonts/Lato.ttf");

Folder architecture

  • public/
    • locales/
      • lang/namespace.json // Example: es/translation.json
  • src/
    • common/
      • typing/
        • interface.ts
        • proptypes.ts
        • types.ts
      • schemas/
        • index.ts
        • auth.ts
      • services/
        • index.ts
        • auth.ts
      • config.ts
      • utils.ts
    • components/
      • Header.tsx
      • index.ts
    • containers/
      • ContainerExample.tsx
      • index.ts
    • context/
      • app/
        • AppContext.tsx
        • reducer.ts
      • service/
        • ServiceContext.tsx
        • http.ts
      • index.ts
    • hoc/
      • withCustomHoc.tsx
      • index.ts
    • hooks/
      • index.ts
      • useCustomHook.ts
    • pages/
      • Home.tsx
    • styles/
      • pages/
        • responsive/
          • _Home.scss
        • Home.scss
      • components/
        • responsive/
          • _Header.scss
        • Header.scss
      • _Mixins.scss
      • Globals.scss
    • i18n.ts
    • main.ts
    • routes.tsx

boilerplatereact's People

Contributors

tuentyfaiv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.