{"id":16403933,"url":"https://github.com/siddharthkp/bae","last_synced_at":"2025-08-19T00:04:42.561Z","repository":{"id":57189117,"uuid":"84747283","full_name":"siddharthkp/bae","owner":"siddharthkp","description":"react made easy","archived":false,"fork":false,"pushed_at":"2019-01-03T14:59:34.000Z","size":498,"stargazers_count":114,"open_issues_count":1,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-04T20:20:22.142Z","etag":null,"topics":["code-splitting","hot-module-replacement","react","server-rendering","streaming","zero-configuration"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/siddharthkp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-12T18:23:24.000Z","updated_at":"2023-11-07T15:33:06.000Z","dependencies_parsed_at":"2022-09-17T23:12:52.598Z","dependency_job_id":null,"html_url":"https://github.com/siddharthkp/bae","commit_stats":null,"previous_names":["siddharthkp/reaqt"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/siddharthkp/bae","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharthkp%2Fbae","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharthkp%2Fbae/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharthkp%2Fbae/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharthkp%2Fbae/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddharthkp","download_url":"https://codeload.github.com/siddharthkp/bae/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddharthkp%2Fbae/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271078559,"owners_count":24695469,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["code-splitting","hot-module-replacement","react","server-rendering","streaming","zero-configuration"],"created_at":"2024-10-11T05:50:47.661Z","updated_at":"2025-08-19T00:04:42.462Z","avatar_url":"https://github.com/siddharthkp.png","language":"JavaScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/siddharthkp/bae/master/art/bae.png\" height=\"100px\"/\u003e\n  \u003cbr\u003e\u003cbr\u003e\n  react made easy\n  \u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n\u0026nbsp;\n\n[![Build Status](https://travis-ci.org/siddharthkp/bae.svg?branch=master)](https://travis-ci.org/siddharthkp/bae)\n\n\u0026nbsp;\n\n### minimal setup\n```\nnpm install bae --save\n```\n\n\nAdd these 2 lines in your `package.json`\n\n```json\n\"scripts\": {\n  \"dev\": \"bae dev\",\n  \"start\": \"bae\"\n}\n```\n\nStart the dev server with `npm run dev`. You just setup server rendering with hot module replacement and hot reload!\n\n\u0026nbsp;\n\n### pages\n\nMake pages like it's the 90s.\n\u0026nbsp;\n- pages are routes: `pages/about` renders `/about` of your website\n\n- pages are rendered on the server\n\n- pages are `streamed` to the browser for quick `time-to-first-byte`\n\n- built in code splitting, each page gets it's own _`page.js`_\n\n- code shared between pages is served as `common.js` for long term caching\n\n- `pages/home.js` renders the homepage `/`\n\n- [why is this important?](https://rauchg.com/2014/7-principles-of-rich-web-applications#server-rendered-pages-are-not-optional)\n\n\u0026nbsp;\n\n```js\nimport React from 'react'\n\nexport default class extends React.Component {\n  constructor (props) {\n    super(props)\n    this.state = {message: 'hello'} // rendered on the server\n  }\n  componentDidMount () {\n    this.setState({message: 'hello world'}) // updated on the browser\n  }\n  render () {\n    return \u003cdiv\u003e{this.state.message}\u003c/div\u003e\n  }\n}\n\n```\n\n\u0026nbsp;\n\n### asyncComponentWillMount\n\nReact has a lifecycle method that get's called on the server `componentWillMount` that can be used to set data for server rendering. But, it [does not support](https://github.com/facebook/react/issues/1739) asynchronous data fetching before rendering the component.\n\nbae introduces a new lifecycle method **to pages** that runs only on the server.\n\n```js\nimport React from 'react'\n\nexport default class extends React.Component {\n  constructor (props) {\n    super(props)\n    this.state = {username: 'siddharthkp'}\n  }\n  asyncComponentWillMount () {\n    /*\n      Return a promise.\n      It will get resolved on the server and passed as props to the component.\n    */\n    return axios.get(`https://api.github.com/users/${this.state.username}`)\n  }\n  render () {\n    return \u003cdiv\u003e{this.props.bio}\u003c/div\u003e\n  }\n}\n\n```\n\n\u0026nbsp;\n\n### components\n\nthe usual, nothing special here.\n\n\u0026nbsp;\n\n### styling\n\ncomes with [styled-components](https://github.com/styled-components/styled-components) which gets rendered on the server.\n\n\u0026nbsp;\n\n### static assets\n\nkeep your images, fonts, etc. in a directory named `static`\n\n\u0026nbsp;\n\n### production\n\n`npm start` will compile, optimize and serve your app.\n\n\u0026nbsp;\n\n### example\n\nCheck out the [example applications](https://github.com/siddharthkp/bae/tree/master/examples) to see how simple this is.\n\n\u0026nbsp;\n\n### like it?\n\n:star: this repo\n\n\u0026nbsp;\n\n### todo\n\n- init by default\n- easy api for lazy loading components\n- server worker support\n- make first build faster\n\n\u0026nbsp;\n\n### license\n\n\u0026nbsp;\n\nMIT © [siddharthkp](https://github.com/siddharthkp)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddharthkp%2Fbae","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddharthkp%2Fbae","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddharthkp%2Fbae/lists"}