{"id":25676370,"url":"https://github.com/mdenisov/micro","last_synced_at":"2025-04-23T13:33:47.816Z","repository":{"id":44967124,"uuid":"250502074","full_name":"mdenisov/micro","owner":"mdenisov","description":"Create server-rendered universal JavaScript applications with no configuration","archived":false,"fork":false,"pushed_at":"2021-08-02T02:32:28.000Z","size":3475,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T13:33:04.177Z","etag":null,"topics":["javascript","reactjs","typescript","universal","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdenisov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-27T10:15:41.000Z","updated_at":"2021-05-14T11:07:32.000Z","dependencies_parsed_at":"2022-09-23T10:51:38.731Z","dependency_job_id":null,"html_url":"https://github.com/mdenisov/micro","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdenisov%2Fmicro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdenisov%2Fmicro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdenisov%2Fmicro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdenisov%2Fmicro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdenisov","download_url":"https://codeload.github.com/mdenisov/micro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250440461,"owners_count":21431001,"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":["javascript","reactjs","typescript","universal","webpack"],"created_at":"2025-02-24T14:26:09.783Z","updated_at":"2025-04-23T13:33:47.770Z","avatar_url":"https://github.com/mdenisov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/mdenisov/micro/tree/master.svg?style=shield)](https://circleci.com/gh/mdenisov/micro/tree/master)\n[![npm version](https://img.shields.io/npm/v/create-frontend)](https://www.npmjs.com/package/create-frontend)\n[![npm dependencies](https://img.shields.io/david/mdenisov/micro)](https://www.npmjs.com/package/create-frontend)\n[![npm downloads](https://img.shields.io/npm/dw/create-frontend)](https://www.npmjs.com/package/create-frontend)\n\nUniversal JavaScript applications are tough to setup. Either you buy into a framework like [Next.js](https://github.com/zeit/next.js) or [react-server](https://github.com/redfin/react-server), fork a boilerplate, or set things up yourself.\n\n**Frontend comes with the \"battery-pack included\"**:\n\n- :fire: Universal Hot Module Replacement, so both the client and server update whenever you make edits. No annoying restarts necessary\n- Comes with your favorite ES6 JavaScript goodies\n- Comes with the same CSS setup as [create-react-app](https://github.com/facebookincubator/create-react-app)\n- Works with [React](https://github.com/facebook/react)\n- Escape hatches for customization via `.babelrc` and `frontend.config.js`\n\n## Quick Start\n\n```\nnpx create-frontend bootstrap my-app\ncd my-app\nyarn start\n```\n\nThen open http://localhost:3000/ to see your app. Your console should look like this:\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/4060187/26324663/b31788c4-3f01-11e7-8e6f-ffa48533af54.png\" width=\"500px\" alt=\"Micro Development Mode\"/\u003e\n\n**That's it**. You don't need to worry about setting up multiple webpack configs or other build tools. Just start editing `src/App.js` and go!\n\nBelow is a list of commands you will probably find useful.\n\n### `yarn start`\n\nRuns the project in development mode.  \nYou can view your application at `http://localhost:3000`\n\nThe page will reload if you make edits.\n\n### `yarn build`\n\nBuilds the app for production to the build folder.\n\nThe build is minified and the filenames include the hashes.\nYour app is ready to be deployed!\n\n### `yarn start:prod`\n\nRuns the compiled app in production.\n\nYou can again view your application at `http://localhost:3000`\n\n### `npm test` or `yarn test`\n\nRuns the test watcher (Jest) in an interactive mode.\nBy default, runs tests related to files changed since the last commit.\n\n### `rs`\n\nIf your application is running, and you need to manually restart your server, you do not need to completely kill and rebundle your application. Instead you can just type `rs` and press enter in terminal.\n\n## \u003cimg src=\"https://user-images.githubusercontent.com/4060187/37915268-209644d0-30e7-11e8-8ef7-086b529ede8c.png\" width=\"500px\" alt=\"Micro Hot Restart\"/\u003e\n\n## Customization\n\n### Customizing Babel Config\n\nFrontend comes with most of ES6 stuff you need. However, if you want to add your own babel transformations, just add a `.babelrc` file to the root of your project.\n\n```\n{\n  \"presets\": [\n    \"stage-0\"\n   ],\n   \"plugins\": [\n     // additional plugins\n   ]\n}\n```\n\nA word of advice: the `.babelrc` file will replace the internal frontend babelrc template. You must include at the very minimum the default frontend/babel preset.\n\n### Extending Webpack\n\nYou can also extend the underlying webpack config. Create a file called `frontend.config.js` in your project's root.\n\n```\n// frontend.config.js\n\nmodule.exports = {\n  modify: (config, { target, dev }, webpack) =\u003e {\n    // do something to config\n\n    return config;\n  },\n};\n```\n\n### CSS Modules\n\nFrontend supports [CSS Modules](https://github.com/css-modules/css-modules) using Webpack's [css-loader](https://github.com/webpack-contrib/css-loader). Simply import your CSS file with the extension `.module.css` and Frontend will process the file using `css-loader`.\n\n```\nimport React from 'react';\nimport styles from './style.module.css';\n\nconst Component = () =\u003e \u003cdiv className={styles.className} /\u003e;\n\nexport default Component;\n```\n\n## Environment Variables\n\n### Build-time Variables\n\n**The following environment variables are embedded during the build time.**\n\n- `process.env.PUBLIC_DIR`: Path to the public directory.\n- `process.env.ASSETS_MANIFEST`: Path to a file containing compiled asset outputs\n- `process.env.LOADABLE_MANIFEST`: Path to a file containing compiled react-loadable outputs\n- `process.env.REACT_BUNDLE_PATH`: Relative path to where React will be bundled during development. Unless you are modifying the output path of your webpack config, you can safely ignore this. This path is used by `react-error-overlay` and webpack to power up the fancy runtime error iframe. For example, if you are using common chunks and an extra entry to create a vendor bundle with stuff like react, react-dom, react-router, etc. called `vendor.js`, and you've changed webpack's output to `[name].js` in development, you'd want to set this environment variable to `/static/js/vendor.js`. If you do not make this change, nothing bad will happen, you will simply not get the cool error overlay when there are runtime errors. You'll just see them in the console. Note: This does not impact production bundling.\n- `process.env.VERBOSE`: default is false, setting this to true will not clear the console when you make edits in development (useful for debugging).\n- `process.env.PORT`: default is `3000`, unless changed\n- `process.env.HOST`: default is `0.0.0.0`\n- `process.env.NODE_ENV`: `'development'` or `'production'`\n- `process.env.BUILD_TARGET`: either `'client'` or `'server'`\n- `process.env.PUBLIC_PATH`: Only in used in `frontend build`. You can alter the `webpack.config.output.publicPath` of the client assets (bundle, css, and images). This is useful if you plan to serve your assets from a CDN. Make sure to _include_ a trailing slash (e.g. `PUBLIC_PATH=https://cdn.example.com/`). If you are using React and altering the public path, make sure to also [include the `crossorigin` attribute](https://reactjs.org/docs/cdn-links.html#why-the-crossorigin-attribute) on your `\u003cscript\u003e` tag in `src/server.jsx`.\n- `process.env.CLIENT_PUBLIC_PATH`: The `NODE_ENV=development` build's `BUILD_TARGET=client` has a different `PUBLIC_PATH` than `BUILD_TARGET=server`. Default is `http://${process.env.HOST}:${process.env.PORT + 1}/`\n\nYou can create your own custom build-time environment variables. They must start\nwith `FRONTEND_`. Any other variables except the ones listed above will be ignored to avoid accidentally exposing a private key on the machine that could have the same name. Changing any environment variables will require you to restart the development server if it is running.\n\nThese environment variables will be defined for you on `process.env`. For example, having an environment variable named `SECRET_CODE` will be exposed in your JS as `process.env.SECRET_CODE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdenisov%2Fmicro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdenisov%2Fmicro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdenisov%2Fmicro/lists"}