Coder Social home page Coder Social logo

fxfactorial / silicondzor Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 392 KB

The Armenian tech community, tech commentary, bug bounty, jobs, calendar.

Home Page: https://silicondzor.com

JavaScript 76.14% CSS 23.86%
armenia armenian tech calendar community node react javascript events codebase

silicondzor's Introduction

silicondzor 🇦🇲

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.

Adding a Facebook group

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.

Purpose

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:

  1. Making a modern Web application using node as the backend.
  2. Using webpack effectively for both development and production.
  3. Using package.json effectively for all your project build needs.
  4. Using HTTPS easily with letsencrypt.
  5. Using React for server side rendering.
  6. Using React for the front end with JSX.
  7. Using sqlite as the backing relational database.
  8. Using express as a server.
  9. Calling the Facebook API.
  10. Using Promises, wrapping callback APIs as Promises.
  11. Sharing code between the frontend and backend.
  12. Securely storing your users passwords with bcrypt.
  13. Using ES7 features of async, await.
  14. Turning your app into a systemd service
  15. Sending enduser HTML emails with nodemailer.
  16. Creating a simple tweet bot service ad-hoc and on schedule.

On a server

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.

Setting up for development

  1. First fork this project, you can do that by click fork in the top
  2. Then clone the project locally with git. (Will be git clone ...)
  3. Once project is cloned locally do npm run setup-dependencies in the root of the project. This assumes you're using Debian/Ubuntu and it installed sqlite3
  4. Then do npm install, this downloads all the JavaScript needed for this project.
  5. 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"
  },

silicondzor's People

Contributors

edgarkhanzadian avatar erodactyl avatar fxfactorial avatar rht avatar sparik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

silicondzor's Issues

Factor out groups

The group names in server.js which means that every time a group is added we need to restart the server.

Two better options

  1. Put in separate file, export as a thunk
  2. Put groups into the DB.

Bad thing about 2 is that a PR can't add a new group whereas it could for 1.

Account verifying seems flawed

I think this is supposed to be a setInterval instead of setTimeout. Otherwise it will clear the object only once, then the object will keep growing.
Even with that fix, an account verification link may be valid not for 1 hour, but for up to 1 hour. It may be valid for 1 second if a user registers 1 second before the register_email_users cleanup. This may be fixed by keeping a queue of registered users, pushing when a user registers and the link is sent, and poping all expired links every 1 hour, for example. Also this will make the implementation of 're-send the link' easier.

Add logging middleware

I want to get some more log info about what is hitting up the server,

morgan seems to be the standard express middleware for logging.

https://github.com/expressjs/morgan

Easy solution: Just print out to stdout all requests
Better solution: Write everything to a file whose name you get via an environment variable.

Use HTTPS

Make sure site works on HTTPS as a best practice example, need to use letencrypt.

Host another site

We can also host another site, hye.life. This means a generalization of the front end and some changes to the backend.

Not sure whether to do this with nginx, which means adding more infrastructure, or to do it at the node level.

Create twitter bot

Pigging backing off of #17 we should also make a twitter bot which automatically posts big events, will need to use the twitter REST API.

Events days

Events that comes from FB API taking too much tables, so other events can't be shown, need to fix it, 1 day for each event. There are events in source code, that came from FB API, but because of being used that day by another event, we don't have it on calendar.

Automatically translate Events?

Many events that we source are in different languages. Apparently there is a free translation service via https://translate.yandex.com, they have an API.

Its not clear though how we should store it though.....concat original description plus translations into one long string might be the easiest way at the moment.

Let end user know what groups are being sourced

We should let the end user know what groups we are sourcing information from, this can be done with a visual queue on the front end.

Now we'll really need to make a separate table for the event sourcing groups and their respective IDs.

Big Addition - Jobs Board

A big addition to silicondzor would be if we had a jobs board open up at the beginning of the month, like hackernews who's hiring.

This is a bigger task, would need to make new UI, new table, new routes.

Create FB dedicated page for silicondzor

We should make a dedicated page for silicondzor on Facebook.com and then have the backend periodically post to the page whenever big events come up.

We'll need to change the schema of events, cause we need to rank events in terms of their importance as we don't want to auto post everything, only the important things. (IE machine learning class at iterate isn't as important as Hive event)

Events time seems off?

Thanks to @rht we have events programmatically sourced from various FB groups, hurrah!

One small thing I'm noticing though, many events say they are at early hours, like 5AM when I suspect them mean to say 5PM. This is probably a simple date mistake in our code, should be an easy fix.

Language and information about event

There can be much more information about event and there have to be an option for user to choose language instead of giving him all types that you have, in that case there will be more place for info about event in tab.

Add more options for end user

Have end users get emailed once a week or something configurable by them for when they get a digest of all the events of that coming week.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.