GithubHelp home page GithubHelp logo

amilner42 / web-app-kickstarter Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 1.0 2.4 MB

[OUTDATED] Develop Modern Web Applications

License: MIT License

JavaScript 11.91% HTML 0.31% Elm 68.03% CSS 0.25% TypeScript 19.50%
elm express kickstarter mongo node typescript

web-app-kickstarter's People

Contributors

amilner42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

morganjk

web-app-kickstarter's Issues

Models for Pages should not be the same

At the moment, we have one "super model" which we pass to every view (component), even though the view only edits the record in it's component. This is bad practice, every view should be getting it's own model and for shared data we should just pass sharedData to all of them.

Add support for scss

Webpack should compile scss.

I suspect the best structure will be having the scss beside the components, so when working on html you can go right there to edit your scss. So webpack needs to detect nested scss.

Switch to JWT

There are certain issues that arise from using cookies with sessionIDs instead of JSON web tokens, this should definitely by switched.

To read about possible race condition problems, read here

LocalStorage save automatically

I think it would be good to just wrap the base component update so that it always calls LocalStorage.save, this way the cacheing happens automatically.

I don't see a downside at the moment (it's async so it shouldn't slow code down).

Switch env variables to flags

The backend currently uses env variables for prod settings, let's switch these to flags so that everything is explicit and we have less state-deployment-bugs.

Script for developing

Should have script ./bin/dev.sh that runs the application while watch for file changes, probably would be nice to use nodemon so server doesn't need to be restarted for backend changes.

Possible two-way data bindings with the Router and the model

I'm not sure exactly what I would want, but there may be better ways to keep the model and the route in sync with each other - I know there are community url router packages that deal with this, possibly take a look at those for inspiration.

At the moment, all you have to do is Router.navigateTo route so it may not even be a problem, hence why I'm moving to V1.

Rethink encode/decoder/cacheEncoder/cacheDecoder situation.

fromJsonString / toJsonString should definitely be generic helpers, not in every model (already done in private repo, will port over soon).

Additionally, we need encoder/decoder/cacheEncoder, but do we even need cacheDecoder - is it still valuable to have it around anyway cause the name helps the code be more readable?

Automatic form-creation module

There is no reason that we should be creating forms manually, not in Elm at least.

I want to be able to pass a record that specifies:

  • The class names for different parts of the form
  • API route to query on form submission
  • Possibly an encoder (?) specifying which part of the form to submit
  • Which inputs are connected to which error messages

I might be missing a few things, but overall it would be fantastic if a form was simply a record!

Fix URL bugginess

Right now there is a bit of url-glitchiness, for instance, if you are logged in and then type the welcome route in the url and hit enter the url will change but the page will not. This is because the page displayed cannot be the welcome page if the user is logged in, the top level View.elm makes sure of that, but it doesn't change the route so you end up with the right page but the wrong route.

I think this can be fixed by adding some logic to urlUpdate which does the check there if that route is valid and changes it if it is not.

Models that are cached in localStorage should have 2 encoders

When encoding a user to send to the backend, we obviously need to encode all the data, but when encoding and then cacheing in localStorage then I don't want to encode the password and have that just sitting in localStorage.

To avoid confusion, we should have encode and encodeForCache, where encodeForCache specifically strips sensitive data or data that we don't want to persist (eg. we don't want errorMessages to persist across browser sessions).

Add tests

For both backend and frontend.

Then just add a line for test script: npm run test

Switch `components` to pages

It needs to be clear how to properly expand the project, no nesting under home-component, just 1 page per update.

Log out button

A user should be able to log out.

This should clear localStorage and remove the session cookie.

Switch backend to typescript

While I didn't want to before, I think typescript has gotten enough support of typing functional programming that it's worth switching over.

On 401 Unauth log user out

The http get/post methods should always double check if they get a 401 unauth back, and if they do they should log the user out. This way their is never that weird bug where they are unauthorized but localStorage says they are authorized....

Add READMEs for frontend/backend.

There is a README at top level, but there should be READMEs in frontend/backend as well that explain things like file structure etc...

I think the README in bin might need an update as well.

The docs need to be good enough for version 0 of this kickstarter!

Bcrypt password on frontend as well

Currently the password is only bcrypted on the backend, while this keeps the passwords in the database safe is someone were to be listening over the wire (if on http) or do a man in the middle attack (can be on https) then it would be better if the password were encrypted as users tend to use the same password accross websites.

Thanks to @g-whiz for pointing that out

Localstorage state passed in as program flag

At the moment we save automatically to localStorage every command, this is convenient. But a certain race arises where when the app first loads, while the port waits for the model to be loaded from localStorage, we save the defaultModel to localStorage.

Instead, the Elm app should get the value passed in from localStorage as a flag that way this race condition goes away.

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.