* Start with webhooks: table and model * Start with webhooks api * Start with webhooks api * Webhook::Event class and events list * Remove commented callbacks * Start with sending events to webhook endpoints * A couple of tests for Articles::Creator * Send event to webhook endpoint on article destroy * Dispatch event on article update * Dispatch event when an article updated from admin * Spec for the webhook job * One more test for the dispatch event job * Integration-like spec for event dispatching to webhook endpoints when creating an article * Use Addressable::URI to parse endpoint url * Add oj as a faster fast_jsonapi backend * Renamed serializers * Move article serialization out of a model * Don't allow to create a webhook event with invalid type * Add fields for ArticleSerializer * Fix webhook event job specs * Specify timeout when dispatching events * Fix webhook job spec * Change webhook events queue name * Change serialized article fields for the dispatchable events * Include user data when serializing an article for webhook event * Moved decorating out of Webhook::DispatchEvent, fixed most specs * Fix route in ArticleSerializer * Move Article decoration to Webhook::PayloadAdapter * Refactor image url helpers to avoid including helpers into serializer * Fix specs * Default url options for production |
||
|---|---|---|
| .github | ||
| .vscode | ||
| app | ||
| bin | ||
| config | ||
| db | ||
| docs | ||
| lib | ||
| log | ||
| public | ||
| spec | ||
| vendor/assets | ||
| .babelrc | ||
| .codeclimate.yml | ||
| .dockerignore | ||
| .editorconfig | ||
| .erb-lint.yml | ||
| .eslintignore | ||
| .gitdocs.js | ||
| .gitignore | ||
| .gitpod.dockerfile | ||
| .gitpod.yml | ||
| .nvmrc | ||
| .postcssrc.yml | ||
| .prettierignore | ||
| .rspec | ||
| .rubocop.yml | ||
| .rubocop_todo.yml | ||
| .ruby-version | ||
| .simplecov | ||
| .travis.yml | ||
| .yardopts | ||
| after_deploy.sh | ||
| CODE_OF_CONDUCT.md | ||
| config.ru | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| docker-entrypoint.sh | ||
| docker-run.sh | ||
| Dockerfile | ||
| dockerhub-readme.md | ||
| empty-module.js | ||
| Envfile | ||
| environment | ||
| Gemfile | ||
| Gemfile.lock | ||
| Guardfile | ||
| jest.config.js | ||
| LICENSE.md | ||
| Makefile | ||
| netlify.toml | ||
| package.json | ||
| Procfile | ||
| Procfile.dev | ||
| Procfile.dev-hot | ||
| Rakefile | ||
| README.md | ||
| yarn.lock | ||
DEV Community 👩💻👨💻
The Human Layer of the StackWelcome to the dev.to codebase. We are so excited to have you. With your help, we can build out DEV to be more stable and better serve our community.
What is dev.to?
dev.to (or just DEV) is a platform where software developers write articles, take part in discussions, and build their professional profiles. We value supportive and constructive dialogue in the pursuit of great code and career growth for all members. The ecosystem spans from beginner to advanced developers, and all are welcome to find their place within our community. ❤️
Table of Contents
Contributing
We encourage you to contribute to dev.to! Please check out the Contributing to dev.to guide for guidelines about how to proceed.
Codebase
The stack
We run on a Rails backend with mostly vanilla JavaScript on the front end, and some Preact sprinkled in. One of our goals is to move to mostly Preact for our front end.
Additional technologies and services are listed on our docs.
Getting Started
This section provides a high-level requirement & quick start guide. For detailed installations, such as getting started with GitPod, Docker, or specific operating systems, please check out our docs.
Prerequisites
- Ruby: we recommend using rbenv to install the Ruby version listed on the badge.
- Yarn: please refer to their installation guide.
- PostgreSQL 9.4 or higher.
Standard Installation
-
Make sure all the prerequisites are installed.
-
Fork dev.to repository, ie. https://github.com/thepracticaldev/dev.to/fork
-
Clone your forked repository, ie.
git clone https://github.com/<your-username>/dev.to.git -
Set up your environment variables/secrets
- Take a look at
Envfile. This file lists all theENVvariables we use and provides a fake default for any missing keys. You'll need to get your own free Algolia credentials to get your development environment running. - This guide will show you how to get free API keys for additional services that may be required to run certain parts of the app.
- For any key that you wish to enter/replace:
- Create
config/application.ymlby copying from the provided template (ie. with bash:cp config/sample_application.yml config/application.yml). This is a personal file that is ignored in git. - Obtain the development variable and apply the key you wish to enter/replace. ie:
GITHUB_KEY: "SOME_REAL_SECURE_KEY_HERE" GITHUB_SECRET: "ANOTHER_REAL_SECURE_KEY_HERE" - Create
- If you are missing
ENVvariables on bootup,enviedgem will alert you with messages similar to'error_on_missing_variables!': The following environment variables should be set: A_MISSING_KEY.. - You do not need "real" keys for basic development. Some features require certain keys, so you may be able to add them as you go.
- Take a look at
-
Run
bin/setup -
That's it! Run
bin/startupto start the application and head tohttp://localhost:3000/
View Full Installation Documentation
Starting the application
We're mostly a Rails app, with a bit of Webpack sprinkled in. For most cases, simply running bin/rails server will do. If you're working with Webpack though, you'll need to run the following:
- Run
bin/startupto start the server, Webpack, and our job runnerdelayed_job.bin/startuprunsforeman start -f Procfile.devunder the hood. alias start="bin/startup"makes this even faster. 😊- If you're using
pryfor debugging in Rails, note that usingforemanandprytogether works, but it's not as clean asbin/rails server.
Here are some singleton commands you may need, usually in a separate instance/tab of your shell.
- Running the job server (if using
bin/rails server) -- this is mostly for notifications and emails:bin/rails jobs:work - Clearing jobs (in case you don't want to wait for the backlog of jobs):
bin/rails jobs:clear
Current gotchas: potential environment issues with external services need to be worked out.
Suggested Workflow
We use Spring, and it is already included in the project.
- Use the provided bin stubs to start Spring automatically, i.e.
bin/rails server,bin/rspec spec/models/,bin/rails db:migrate. - If Spring isn't picking up on new changes, use
spring stop. For example, Spring should always be restarted if there's a change in environment key. - Check Spring's status whenever with
spring status.
Caveat: bin/rspec is not equipped with Spring because it affects Simplecov's result. Instead, use bin/spring rspec.
Additional docs
Check out our dedicated docs page for more technical documentation.
Core team
Vulnerability disclosure
We welcome security research on DEV under the terms of our vulnerability disclosure policy.
License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Please see the LICENSE file in our repository for the full text.
Like many open source projects, we require that contributors provide us with a Contributor License Agreement (CLA). By submitting code to the DEV project, you are granting us a right to use that code under the terms of the CLA.
Our version of the CLA was adapted from the Microsoft Contributor License Agreement, which they generously made available to the public domain under Creative Commons CC0 1.0 Universal.
Any questions, please refer to our license FAQ doc or email yo@dev.to
Happy Coding ❤️