Coder Social home page Coder Social logo

chat-demo's Introduction

A simple serverless chat application

This is a living project built to demonstrate serverless concepts

Configure

Create a file named credentials.json from the template, and fill in all the secret info. You'll have to get this from Matt.

cp credentials-template.json credentials.json

Develop

To develop, install dependencies with NPM and launch webpack dev server:

npm install
npm run webpack-serve

The app is accessible at localhost:3000. The files are automatically recompiled and served from memory as the contents change.

Test

There are no tests at the moment, but there is static code analysis, using eslint. To check your code for issues, run the following command:

npm run lint

Build

Build static files in the public directory with NPM:

npm install
npm run build

Deploy

After building, you can host the root directory somewhere, like Amazon S3

npm run deploy

This will copy the contents of the public/ directory to s3://chat-demo. In order to work, you must:

  • Have aws cli setup in your path
  • Have your AWS cli credentials properly configured
  • Have R/W access to the s3://chat-demo bucket

References

chat-demo's People

Contributors

cuperman avatar mattfite avatar

Watchers

 avatar  avatar

chat-demo's Issues

Access usage data

it would be great to be able to see:

  • number of active users
  • number of active conversations
  • monthly volume of message traffic

Should only be available to elevated or admin users ( #10 ).

UX improvements for Stesie's app

  • Hide the text input and send button until connection is successful
  • Clear input when message is sent
  • Enter key should send the message, not refresh the page

Remove secret keys in public assets

I removed the secret keys from the source code, but they are still included in the compiled assets. Explore creating a lambda function that creates the URL hash and reads the secret keys from an environment variable. The the app can fetch the URL before connecting to the WebSocket via API Gateway.

Make it mobile

It looks kind of crappy on mobile. You can add a couple meta tags to make it render better on a small display.

Implement Socket.io UI

Create an alternate UI which is based on the tutorial from socket.io. The clients should be able to communicate using either UI.

Consider adding user roles

Once there are users with authentication ( #9 ) we need to determine if there should be an administrative user to manage or remove other user accounts or topics.

Deploy command

Create a command to deploy the static files to s3.

I recommend adding an npm script npm run deploy

JavaScript Linting

Use eslint for static code analysis of javascript files. This would be nice to have in lieu of unit tests, so we can establish good coding practices and demonstrate how this can be added to the CodeStar build pipeline.

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.