{"id":17043462,"url":"https://github.com/kevinschaich/react-full-stack-starter","last_synced_at":"2025-04-12T15:11:30.493Z","repository":{"id":114254603,"uuid":"84479590","full_name":"kevinschaich/react-full-stack-starter","owner":"kevinschaich","description":"🎈Full-stack React boilerplate using `create-react-app`, Babel, Node.js, and express","archived":false,"fork":false,"pushed_at":"2018-09-16T20:13:33.000Z","size":22,"stargazers_count":25,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T09:45:11.274Z","etag":null,"topics":["babel","create-react-app","database","database-connector","es6","express","expressjs","full-stack","fullstack","fullstack-boilerplate","fullstack-javascript","mongo","mongodb","mongoose","node","node-js","nodejs","react","react-app","reactjs"],"latest_commit_sha":null,"homepage":"","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/kevinschaich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-09T19:18:53.000Z","updated_at":"2024-03-15T20:27:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"94605d0a-0474-4f52-b887-3c7eeefb4c5a","html_url":"https://github.com/kevinschaich/react-full-stack-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinschaich%2Freact-full-stack-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinschaich%2Freact-full-stack-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinschaich%2Freact-full-stack-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevinschaich%2Freact-full-stack-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevinschaich","download_url":"https://codeload.github.com/kevinschaich/react-full-stack-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586230,"owners_count":21128997,"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":["babel","create-react-app","database","database-connector","es6","express","expressjs","full-stack","fullstack","fullstack-boilerplate","fullstack-javascript","mongo","mongodb","mongoose","node","node-js","nodejs","react","react-app","reactjs"],"created_at":"2024-10-14T09:29:36.971Z","updated_at":"2025-04-12T15:11:30.486Z","avatar_url":"https://github.com/kevinschaich.png","language":"JavaScript","readme":"# React Full-Stack Starter Kit\n\nFull-stack React boilerplate using [`create-react-app`](https://github.com/facebookincubator/create-react-app), [Babel](https://babeljs.io/), [Node.js](https://nodejs.org/en/), and [express](https://expressjs.com/). Plays nicely with DB connectors such as [MongoDB](https://www.npmjs.com/package/mongodb), [Mongoose](https://www.npmjs.com/package/mongoose), [MySQL](https://www.npmjs.com/package/mysql) and many others.\n\nFully-updated for ES6 syntax.\n\nLoosely Based on [Fullstack React's demo](https://github.com/fullstackreact/food-lookup-demo), just leaned-out. Check out their [blog post](https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/) for details on how the proxy setup allows a concurrent client/server side.\n\n## Installation/Usage\n\n**Run the following in your terminal:**\n\n```bash\ngit clone https://github.com/kevinschaich/react-full-stack-starter\ncd react-full-stack-starter\nnpm install\n\ncd client\nnpm install\n\ncd ..\nnpm start\n```\n\nVisit [http://localhost:3000](http://localhost:3000) in your browser to see the server running!\n\n**Note for Windows Users:** If you encounter errors during installation, I recommend giving [CMDer](http://cmder.net/) a try.\n\n## Example DB Connection with MongoDB\n\n#### Install MongoDB\n\nMake sure you have [MongoDB installed](https://docs.mongodb.com/manual/installation/). If you don't have any databases set up, you can run this command to populate a few rows (be sure to change `db-name` and `collection-name`):\n\n`mongo db-name --eval 'db.collection-name.insert({\"name\": \"John Doe\"}, {\"name\": \"Jane Doe\"})'`\n\nRun the following in the **root directory** of the repository:\n\n`npm install --save mongodb`\n\n#### Configure MongoDB\n\nIn the top of `server.js`, add the following lines to import Mongo and set the database URI. Be sure to replace `database-name-here` with the name of your database in Mongo.\n\n```javascript\nconst MongoClient = require('mongodb').MongoClient;\nconst url = 'mongodb://localhost:27017/database-name-here';\n```\n#### Retrieve objects from DB\n\nNow, near the bottom of `server.js`, update the `app.get('/api'...)` route to retrieve data from your DB. Be sure to replace `collection-name-here` with the name of your collection in Mongo.\n\n```javascript\napp.get('/api', (req, res) =\u003e {\n  MongoClient.connect(url).then(db =\u003e {\n    const cursor = db.collection('collection-name-here')\n      .find({})\n      .limit(5)\n      .toArray()\n    .then((data) =\u003e {\n      res.json(data);\n    });\n  }).catch(err =\u003e {\n    console.log(err);\n  });\n});\n```\n\nYour server should be pulling items from the database when it receives a call to `/api`. You can test this by visiting [http://localhost:3001/api](http://localhost:3001/api) and see if the response is displayed properly.\n\n#### Update Client Code\n\nBack on the client side, in `client/src/App.js`, you need to update your `render` method to match the format of objects in MongoDB. For example, if your stored objects in Mongo look like the following:\n\n```json\n[\n  {\"name\": \"Person1\", \"age\": 38},\n  {\"name\": \"Person2\", \"age\": 27},\n]\n```\n\nYou could change the mapping to populate the `name` field of each item on the page like so:\n\n```jsx\n  const items = this.state.items.map(\n    (item, i) =\u003e (\u003ch1 key={i}\u003e{item.name}\u003c/h1\u003e)\n  );\n```\n\nRun the server using `npm start` -- you should see items from your DB being populated on the page!\n\n\n## Deploying to Heroku\n**Install the Heroku CLI and set up your account if you haven't already.**  \n[Follow the instructions here.](https://devcenter.heroku.com/articles/heroku-cli)  \n\n**Run the following in your terminal**\n```\n# cd into client folder and run the build script\ncd client\nnpm run build\ncd ..\n\n# commit the changes to git\ngit add .\ngit commit -m \"build for deployment\"\n\n# create the heroku app and deploy\nheroku create\ngit push heroku master\n```\n\n## Contributing/Pull Requests\n\nPlease feel free to submit issues/pull requests! I welcome any corrections or suggestions that could make the repository better for others to use and build off of as well.\n\n## License\n\nMIT © [Kevin Schaich](https://kevinschaich.io)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinschaich%2Freact-full-stack-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinschaich%2Freact-full-stack-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinschaich%2Freact-full-stack-starter/lists"}