This is the source code of silicondzor
If you use any of this code then you must release it along with your code since this is licensed as GPL-3.0.
Եթե դուք օգտագործեք այս կոդի որևէ մաս, ապա դուք պետք է այն հրապարակեք ձեր կոդի հետ միասին, քանի որ այն լիցենզավորված է որպես GPL-3.0.
Если вы используете этот код, то вы должны выпустить его на ряду с вашим кодом так, как это заверено в лицензии GPL-3.0.
To add a FB group, just checkout the groups.json file, add a
Facebook group name and its ID, then open a pull request with the
new group added.
Use this codebase as a learning experience, to see how a professional project is done and how a codebase is organized.
This project has examples of:
- Making a modern Web application using node as the backend.
- Using webpack effectively for both development and production.
- Using package.json effectively for all your project build needs.
- Using HTTPS easily with
letsencrypt. - Using React for server side rendering.
- Using React for the front end with JSX.
- Using sqlite as the backing relational database.
- Using express as a server.
- Calling the Facebook API.
- Using Promises, wrapping callback APIs as Promises.
- Sharing code between the frontend and backend.
- Securely storing your users passwords with bcrypt.
- Using
ES7features ofasync,await. - Turning your app into a
systemdservice - Sending enduser HTML emails with nodemailer.
- Creating a simple tweet bot service ad-hoc and on schedule.
Once you deploy this project to a server, you often want to keep it up
and alive. For you you should use the standard Linux process manager
tool called systemd. This project include a silicondzor.service
file mostly setup for this project. You can adjust this file and place
it in /etc/systemd/system. systemd will watch your process and
restart it when it dies, monitors it for you.
Now to start your app, do systemctl start silicondzor.service. To make
sure your app starts whenever your server starts, do:
systemctl enable silicondzor.service. Other choices are stop and
restart.
You'll probably want to see what's happening as well, your console.log
output will go to /var/log/syslog. See it update in real time with:
tail -f /var/log/syslog.
To see only the logs relevant to your service, do journalctl -u silicondzor
For convenience there is a deploy-restart option for pushing a
project in a production flow, it assumes you have silicondzor as a
named connection in your ~/.ssh/config and that silicondzor is a
directory in the home directory of the sshed in user.
- First fork this project, you can do that by click
forkin the top - Then clone the project locally with
git. (Will begit clone ...) - Once project is cloned locally do
npm run setup-dependenciesin the root of the project. This assumes you're usingDebian/Ubuntuand it installedsqlite3 - Then do
npm install, this downloads all the JavaScript needed for this project. - Now you can create a database, do that with
npm run create-db.
To get the best experience, open 3 terminals and in the 1st one do
npm run babel-watch, then npm run webpack-watch in the 2nd, and in
the 3rd one npm run server-watch. This will automatically rebuild
everything whenever you have a change in the source code and restart
the server if something changed to the server side code.
Note: You might get trouble with sqlite3 or bcrypt not properly
loading as a module, try doing: npm install sqlite3 --build-from-source and npm install bcrypt --build-from-source.
Remember, you can see all the commands in package.json in the
scripts field, these come up for npm run <some_script_name>.
"scripts": {
"babel-watch": "NODE_ENV='debug' babel lib/*.jsx --watch --out-dir .",
"webpack-watch": "NODE_ENV='debug' webpack --progress -d --colors --watch",
"server-watch": "NODE_ENV='debug' nodemon --harmony_async_await backend/server.js",
"prod-build": "NODE_ENV='production' webpack --config webpack.prod.js --progress --colors -p && babel lib/*.jsx --out-dir .",
"create-db": "cat backend/setup_database.sql | sqlite3 silicondzor.db"
},