Skip to content

praihan/smartdirect-backend

Repository files navigation

Smartdirect

Build Status

Smartdirect is like Dropbox for URL-shorteners. Instead of files, you store links which you can update any time. So /blogs/latest can be updated every time you post and everyone with the link will always see your latest post!


Related Repositories

Roadmap

  • User
    • JWT Authentication with dynamic user info
    • Friendly-name generation
    • JSON API access w/ Authorization (tested)
  • Directory
    • Closure tree structure
    • Ownership validation (tested)
    • Name validation (tested)
    • Cascading delete (tested)
    • JSON API access w/ Authorization (tested)
  • Linkation
    • Ownership validation (needs testing)
    • Name validation (needs testing)
    • URL validation (needs testing)
    • Cascading delete from parent directory
    • JSON API access w/ Authorization (partial / needs testing)
  • Redirection
    • Friendly-name of user
    • Proper indexes for optimized look up (needs verification)
    • Redis/CDN cache integration using per-link TTL
  • Deployment
    • Heroku Ruby on Rails
    • Heroku Redis or CDN setup
  • Travis CI

Ruby Version

Smartdirect is tested with Ruby 2.3.1 and PostgreSQL 9.4 on Travis CI. See .travis.yml and .ruby-version.

Running

Smartdirect is built with Rails 5. If you don't already know how to work with rails, consider JetBrains RubyMine.

Configuration

To run the app, you must create a .env file based on .env.template. This file will set environment variables for you but only in development. You will need to set the appropriate environment variables yourself in production.

Application settings can be found in config/settings.yml and config/settings/.

Database Setup

You may set up a PostgreSQL database on localhost for testing. You will need to do the following in psql:

CREATE USER smartdirect; /* with password `smartdirect` */
CREATE DATABASE smartdirect_dev;

REVOKE CONNECT ON DATABASE smartdirect_dev FROM PUBLIC;
GRANT CONNECT ON DATABASE smartdirect_dev TO smartdirect;

If you plan on deleting and recreating databases you may also want to do the following:

ALTER USER smartdirect CREATEDB;
ALTER DATABASE smartdirect_dev OWNER TO smartdirect

Please see settings/development.yml to see/modify the connection settings used when developing.

Connection settings can also be modified using the environment variables SMD_DATABASE_HOST, SMD_DATABASE_USER, SMD_DATABASE_PASSWORD, SMD_DATABASE_DB, and SMD_DATABASE_PORT.

Make sure to run bin/rails db:migrate RAILS_ENV=development before starting!

Testing

Testing is done with RSpec.

You may use an IDE such as JetBrains RubyMine or use bin/rspec from the command line.

Please see config/settings/test.yml to see/modify the connection settings used when testing.

Make sure to run bin/rails db:migrate RAILS_ENV=test before running tests!

Deploying

TODO

Contributions

Contributions are welcome. Smartdirect is MIT Licensed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published