Giter Club home page Giter Club logo

phoenix_starter's Introduction

PhoenixStarter

A starter that combines Phoenix + Snowpack + React. (but you can use anything else, like Svelte, which is great)

Prerequisites

  • postgres - install via Homebrew or your preferred package manager
  • asdf-vm - check their website
  • foreman - foreman on Homebrew and ruby-foreman on Ubuntu

Getting Started

To start your Phoenix app:

  • Install dependencies and setup database with bin/setup
  • Start Phoenix and webpack with bin/server

To test and lint your app you can also do:

  • bin/test to run the Phoenix test suite
  • bin/lint to lint CSS, Javascript and Elixir code
  • bin/ci to replicate the CI pipeline, which runs all of the above.

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Diferences to the phx.new

phx new does a great job of a bootstrapping a Phoenix app for you, but we usually run things a little different. This template has a few differences, mostly on the frontend side of things. We run all of our frontend code through Snowpack and that can be deployed as a standalone app. Here we serve the app at the root of the project, so /, and catching all fallback requests there, so client-side routing works. You can however, split it up entirely and serve the frontend at a different place.

Also, one of the most important changes is the usage of wallaby to make fullstack integration testing. So we can test the whole application. That's where the PageController acts, serving the index.html that snowpack produces during tests.

During development, you should use the build from the snowpack dev-server under port 8080. The frontend is automatically configured to use localhost:4000 (phoenix endpoints) during dev, and / on testing and production.

Auth

We also have a basic auth set up. You check the login routes on the frontend and the logic on the backend. Currently there is sign up, login and logout logic. The auth logic can work via the Phoenix session, which in turn uses a secure cookie, which is also advised for web clients.

User's have a email and a password (hashed with argon2). Currently there is no email logic, but that is on the roadmap.

About

This starter kit is developed and maintained by Finiam.

Leave potential improvements and suggestions as issues on Github. Anything else reach us via email.

phoenix_starter's People

Contributors

dependabot[bot] avatar dependabot-preview[bot] avatar jfranciscosousa avatar davidesilva avatar zepedroresende 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.