Code Monkey home page Code Monkey logo

react-phoenix-users-boilerplate's Introduction

React + Phoenix boilerplate

Demo: http://phxboilerplate.herokuapp.com

This is a basic setup for an React(16) + Phoenix(1.3)/Elixir(1.7) project, using webpack(4) and users with authentication.

STARTING PROJECT

git clone https://github.com/chernyshof/react-phoenix-users-boilerplate appname
cd appname

Changing app name in files(commands for unix like systems)

grep -rl Boilerplate | xargs sed -i s@Boilerplate@Appname@g
grep --exclude={package.json,yarn.lock,.babelrc} -rl boilerplate | xargs sed -i s@boilerplate@appname@g
find . -depth -exec rename 's/boilerplate/appname/g' {} \; 

Or if you're using different rename version

find . -iname "*boilerplate*" -exec rename boilerplate appname '{}' \;

Reinit git

rm -rf .git
git init
git add priv/static/favicon.ico -f
git add priv/static/images/phoenix.png -f

Download dependencies

mix deps.get
mix ecto.create
mix ecto.migrate
cd assets
yarn install
cd ..

Start server

mix phx.server

SUPERUSER

After running mix ecto.migrate command you will have superuser:

email: [email protected]
password: 12345678

You probably wanna change it :)

SETUP

Redux logger

If you want to turn redux logger on just assign true to useReduxLogger in app/store/index.js

...
const useReduxLogger = true;
...

DEPLOYING TO HEROKU

You should have installed heroku-cli

Create heroku application

heroku create --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"

Optional change app address

heroku apps:rename appname

Adding phoenix buildpack

heroku buildpacks:add https://github.com/chernyshof/heroku-buildpack-phoenix-static.git

Add you address

in config/prod.exs change in config, :appname, Appname.Repo, url line(if needed)

url: [scheme: "https", host: "appnameaddress.herokuapp.com", port: 443],

Creating Environment Variables

heroku addons:create heroku-postgresql:hobby-dev
heroku config:set POOL_SIZE=18

Secret key

gen secret key

$ mix phx.gen.secret
xvafzY4y01jYuzLm3ecJqo008dVnU3CN4f+MamNd1Zue4pXvfvUjbiXT8akaIF53
now set key that you got in heroku
heroku config:set SECRET_KEY_BASE="xvafzY4y01jYuzLm3ecJqo008dVnU3CN4f+MamNd1Zue4pXvfvUjbiXT8akaIF53"

Guardian secret key

$ mix phx.gen.secret
xvafzY4y01jYuzLm3ecJqo008dVnU3CN4f+MamNd1Zue4pXvfvUjbiXT8akaIF53
now set key that you got in heroku
heroku config:set GUARDIAN_SECRET_KEY="xvafzY4y01jYuzLm3ecJqo008dVnU3CN4f+MamNd1Zue4pXvfvUjbiXT8akaIF53"

Deploy time!

git push heroku master
heroku run "POOL_SIZE=2 mix ecto.migrate"

REQUIREMENTS

USED PLUGINS AND TECHNOLOGIES

Frontend

Backend

react-phoenix-users-boilerplate's People

Contributors

chernyshof avatar wewelll avatar

Watchers

James Cloos avatar febil avatar

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.