{"id":19607394,"url":"https://github.com/victorcmarinho/archref-react","last_synced_at":"2025-04-27T19:33:15.073Z","repository":{"id":37094086,"uuid":"318978464","full_name":"victorcmarinho/archref-react","owner":"victorcmarinho","description":"(Boilerplate) Reference architecture for React projects with Typescript","archived":false,"fork":false,"pushed_at":"2024-07-05T08:42:03.000Z","size":20652,"stargazers_count":6,"open_issues_count":28,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T03:04:58.683Z","etag":null,"topics":["eslint","react","storybook","styled-theming","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victorcmarinho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null}},"created_at":"2020-12-06T07:42:01.000Z","updated_at":"2022-02-24T20:11:26.000Z","dependencies_parsed_at":"2023-02-18T21:45:44.780Z","dependency_job_id":"7107cc48-84ad-46d5-8acb-4ece3742c193","html_url":"https://github.com/victorcmarinho/archref-react","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcmarinho%2Farchref-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcmarinho%2Farchref-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcmarinho%2Farchref-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victorcmarinho%2Farchref-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victorcmarinho","download_url":"https://codeload.github.com/victorcmarinho/archref-react/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251196500,"owners_count":21550964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","react","storybook","styled-theming","typescript"],"created_at":"2024-11-11T10:10:27.886Z","updated_at":"2025-04-27T19:33:14.254Z","avatar_url":"https://github.com/victorcmarinho.png","language":"TypeScript","readme":"# React Reference Architecture\n[![Check Code](https://github.com/victorcmarinho/arch-ref/actions/workflows/checkcode.yml/badge.svg)](https://github.com/victorcmarinho/arch-ref/actions/workflows/checkcode.yml)\n[![CodeQL](https://github.com/victorcmarinho/archref-react/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/victorcmarinho/archref-react/actions/workflows/codeql-analysis.yml)\n### Preview\n![preview image](https://raw.githubusercontent.com/victorcmarinho/archref-react/main/images/preview.gif)\n\n## BFF - Proxy Configurate\n\nOften serve the front-end React app from the same host and port as their backend implementation.\n\nExemple:\n\n```\n/             - static server returns index.html with React app\n/todos        - static server returns index.html with React app\n/api/todos    - server handles any /api/* requests using the backend implementation\n\n```\n\nFor that, it is only necessary to configure the file: src/setupProxy.js \n\nexample: \n\n```\nconst { createProxyMiddleware } = require('http-proxy-middleware');\n\nmodule.exports = function(app) {\n  // ...\n};\n\n```\n\n```\nconst { createProxyMiddleware } = require('http-proxy-middleware');\n\nmodule.exports = function(app) {\n  app.use(\n    '/api',\n    createProxyMiddleware({\n      target: 'http://localhost:5000',\n      changeOrigin: true,\n    })\n  );\n};\n\n```\n\n\n## Storybook\n`npm run storybook`\n`yarn storybook`\n\nStorybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.\n\n![Storybook](https://raw.githubusercontent.com/storybookjs/storybook/master/media/storybook-intro.gif)\n\n## Develop\n\n`npm start`\n`yarn start`\n[https://localhost:3000]\n\n## Build\n\n`npm run build`\n`yarn build`\n\n## Build Storybook\n`npm run build-storybook`\n`yarn build-storybook`\n\n## Unit Tests\n\n`npm test`\n`yarn test`\n\n**This is your source code tree:**\n\n```\nsrc\n|-- assets\n|-- components\n|-- config // all aplications configs, external services and interceptores\n|-- hooks\n|-- mocks\n|-- models\n|-- pages\n|-- routes\n|-- services // all query and functions request \n|-- utils\n|-- Bootstrap.tsx\n|-- App.tsx\n|-- index.tsx\n|-- react-app-env.d.ts\n|-- reportWebVitals.ts\n|-- service-worker.ts\n|-- serviceWorkerRegistration.ts\n|-- setupProxy.js\n|-- setupTests.ts\n...\n```\n\n**This is your component structure:**\n\n```\n...\ncomponents\n|-- YourComponent\n    |-- index.tsx\n    |-- styles.ts\n    |-- YourComponent.spec.ts\n    |-- YourComponent.stories.ts\n...\n\nor\n\n...\ncomponents\n|-- YourComponent\n    |-- index.tsx\n    |-- styles.ts\n    |-- interfaces.ts\n    |-- YourComponent.ts\n    |-- YourComponent.spec.ts\n    |-- YourComponent.stories.ts\n...\n\nor\n\n...\ncomponents\n|-- YourContainerComponents\n    |-- Component1\n    |-- Component2\n    |-- Component3\n    |-- index.ts\n...\n\n\n```\n\n**This is your page structure:**\n\n```\n...\nPages\n|-- YourPage\n    |-- index.tsx\n    |-- styles.ts\n    |-- interface.ts \n    |-- YourPage.spec.ts\n    |-- YourPage.stories.ts\n...\n```\n\n\n`./assets`\n\nHere will be all your project assets as images, icons...\n\n`./components`\n\nComponents are presentational only elements, grouping UI items\n\n`./configs`\n\nHere will be all configurations for external and internal services\n\n`./hooks`\n\nServices are responsible to handle the connection with all external elements, like APIs and global functions\n\n`./mocks`\n\nAll mock data for your unit testes, examples and any mocks\n\n`./models`\n\nglobal interfaces and models that your project needs\n\n`./pages`\n\nPages are mapped in routes and have all the containers needed to implement a functionality\n\n`./routes`\n\nRoutes contains the `react-router-dom` implementation to map the project's routes to the respective pages\n\n`./services`\n\nHere will be all query and request funcions\n\n`./styles`\n\nHere will be all global and css(relatives)\n\n`./utils`\n\nDirectory to keep all utils functions to share all over the project\n\n## Enviroments\n\nYour project can consume variables declared in your environment as if they were declared locally in your JS files. By default you will have NODE_ENV defined for you, and any other environment variables starting with ``REACT_APP_.``\n\n\n\u003e WARNING: Do not store any secrets (such as private API keys) in your React app!\n\u003e Environment variables are embedded into the build, meaning anyone can view them by inspecting your app's files.\n\u003e Create .env.test.local and .env.local before run project\n\n**Adding Development Environment Variables In**\n\nTo define permanent environment variables, create a file called .env in the root of your project:\n\n``REACT_APP_NOT_SECRET_CODE=abcdef```\n\n**What other files can be used**\n\n- ``.env``: Default.\n- ``.env.local``: Local overrides. This file is loaded for all environments except test.\n- ``.env.development``, , : Environment-specific settings..env.test.env.production\n- ``.env.development.local``, , : Local overrides of environment-specific settings..env.test.local.env.production.local\n\nFiles on the left have more priority than files on the right:\n\n- ``npm start``: , , , ``.env.development.local`` ``.env.local`` ``.env.development`` ``.env``\n- ``npm run build``: , , , ``.env.production.local`` ``.env.local`` ``.env.production`` ``.env``\n- ``npm test``: , , (note is missing) ``.env.test.local `` ``.env.test.env`` ``.env.local``\n\n**Example**\n\n```\nREACT_APP_VERSION=$npm_package_version\n# also works:\n# REACT_APP_VERSION=${npm_package_version}\n\nDOMAIN=www.example.com\nREACT_APP_FOO=$DOMAIN/foo\nREACT_APP_BAR=$DOMAIN/bar\n```\n\n### More utils commands\n\nAnalyzer your build bundle\n`npm run analyze`\n`yarn analyze`\n\nFind and fix Javascrit and TypeScript problems according to pre-defined rules\n`npm run analyze`\n`yarn analyze`\n\nFind and fix code formatted\n`npm run prettier`\n`yarn prettier`\n\n# Advantages of using this react project template\n\nThe project is already configured with:\n\n- React\n- Typescript\n- Jest\n- Babel-root-import\n- unit testing example\n- Eslint\n- Prettier\n- Styled\n- Styled Theming\n- Husky\n- Storybook\n- PWA\n- Integration back-end proxy (http-proxy)\n\n# Getting Started with Create React App\n\nThis project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `yarn start`\n\nRuns the app in the development mode.\\\nOpen [http://localhost:3000](http://localhost:3000) to view it in the browser.\n\nThe page will reload if you make edits.\\\nYou will also see any lint errors in the console.\n\n### `yarn test`\n\nLaunches the test runner in the interactive watch mode.\\\nSee the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.\n\n### `yarn build`\n\nBuilds the app for production to the `build` folder.\\\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.\\\nYour app is ready to be deployed!\n\nSee the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.\n\n### `yarn eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can’t go back!**\n\nIf you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.\n\nYou don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.\n\n## Learn More\n\nYou can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).\n\nTo learn React, check out the [React documentation](https://reactjs.org/).\n\nYou can learn more web develop tools [web.dev](https://web.dev/)\n\n\n### Main dependecies\n\n- [@apollo/client](https://www.npmjs.com/package/@apollo/client)\n- [axios](https://www.npmjs.com/package/axios)\n- [date-fns](https://date-fns.org/)\n- [graphql](https://www.npmjs.com/package/graphql)\n- [lodash](https://lodash.com/)\n- [polished](https://www.npmjs.com/package/polished)\n- [react](https://reactjs.org/)\n- [react-hook-form](https://react-hook-form.com/)\n- [react-icons](https://react-icons.github.io/react-icons/)\n- [react-lottie](https://www.npmjs.com/package/react-lottie) more: https://lottiefiles.com/\n- [react-router-dom](https://reactrouter.com/web/guides/quick-start)\n- [styled-components](https://styled-components.com/)\n- [workbox](https://create-react-app.dev/docs/making-a-progressive-web-app)\n\n### Main dev dependecies\n\n- [storybook](https://storybook.js.org/)\n- [testing-library](https://testing-library.com/)\n- [axios-mock-adapter](https://www.npmjs.com/package/axios-mock-adapter)\n- [eslint](https://eslint.org/)\n- [husky](https://www.npmjs.com/package/husky)\n- [lint-staged](https://www.npmjs.com/package/lint-staged)\n- [prettier](https://prettier.io/)\n- [react-test-renderer](https://pt-br.reactjs.org/docs/test-renderer.html)\n- [source-map-explorer](https://www.npmjs.com/package/source-map-explorer)\n- [typescript](https://www.typescriptlang.org/)\n- [web-vitals](https://web.dev/vitals/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcmarinho%2Farchref-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictorcmarinho%2Farchref-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictorcmarinho%2Farchref-react/lists"}