Skip to content
A fun friendly chat app
Objective-C JavaScript Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mobile/ios/Marshmallow
server
.gitignore
.travis.yml
CONTRIBUTING.md
PRESS-RELEASE.md
README.md
STYLE-GUIDE.md

README.md

Stories in Ready

Build Status

Marshmallow

marshmallow

An iOS chat app made for easy sharing of news, videos and images with your friends.

Team

Table of Contents

  1. Requirements
  2. Usage
  3. Backend Development
  4. Contributing

Requirements

  • Node 0.10.x
  • NPM
  • Xcode 7
  • Cocoapods
  • Docker
  • MySQL
  • Go

Usage

Client

This is all done in the mobile/ios/Marshmallow directory:

  1. Installing Dependencies
pod install
  1. Open Marshmallow.xcworkspace in Xcode

  2. In Xcode open the file keys.example.plist, where it says KEY_HERE replace it with your Youtube API Key

  3. Now you can click build in Xcode and start using the app in the simulator

Server

Before attempting to start the server, make sure you have the trends package in your Go workspace. Find the repo here.

  1. Go to the the server directory
  2. Fill out environment variables in docker-compose.yml.example
  3. Rename file docker-compose.yml.example to docker-compose.yml
  4. Activate docker machine
  5. Run docker-compose up

Backend Development

API Endpoints


POST /signup

Description: Creates a new user
Authentication Required: No

/* Request Body */
{
  “email”: STRING,
  “oauthToken”: STRING,
  “facebookId”: STRING
}
/* Response Body */
{
  "email": STRING,
  "facebookId": STRING
}

POST /login

Description: Authenticates a client by generating a token
Authentication Required: No

/* Request Body */
{
  “email”: STRING,
  “oauthToken”: STRING,
  “facebookId”: STRING
}

POST /userlist

Description: Given a list of facebook users, filter out the ones that are not signed up with marshamallow and return the list
Authentication Required: Yes

/* Request Body */
{
  “users”: [
    facebookIds (STRING) ...
  ]
}
/* Response Body */
{
  “users: [
    facebookIds (STRING) ...
  ]
}

POST /chat

Description: Creates a new chatroom for the given users. Needs at least two users in the users array
Authentication Required: Yes

/* Request Body */
{
  “users”: [
    facebookIds (STRING)
  ]
}
/* Response Body */
{
  “chatId”: STRING
}

GET /chat

Description: Retrieves list of chats the user is in
Authentication Required: Yes

/* Response Body */
{
  “chats”:[
    {
      chatId: STRING,
      users: [facebookIds, ..]
    },
    ...
  ]
}

POST /chat/:id

Description: Post a message to a chat
Authentication Required: Yes

/* Request Body */
{
  “text”: STRING,
  “youtubeVideoId”: STRING,
  “googleImageId”: STRING
}

GET /chat/:id

Description: Retrieve messages in a chat
Authentication Required: Yes

/* Response Body */
{
  “messages”: [
    {
      userFacebookId: STRING,
      chatId: STRING,
      text: STRING,
      createdAt: ISO8601 STRING,
      youtubeVideoId: STRING,
      googleImageId: STRING,
      redditAttachment: {
        title: STRING,
        url: STRING,
        thumbnail: STRING
      }
    }, ...
  ]
}

GET /messages?timestamp=

Description: Retrieve messages in all chats since time x (the timestamp param)
Authentication Required: Yes

/* Response Body */
{
  “messages”: [
    {
      userFacebookId: STRING,
      chatId: STRING,
      text: STRING,
      createdAt: ISO8601 STRING,
      youtubeVideoId: STRING,
      googleImageId: STRING,
      redditAttachment: {
        title: STRING,
        url: STRING,
        thumbnail: STRING
      }
    }, ...
  ]
}

GET /trends

Description: Retrieve trending links (from reddit)
Authentication Required: Yes

/* Response Body */
{
  “links”: [
    {
      “url”: STRING,
      “thumbnail”: STRING,
      “title”: STRING
    }, ...
  ]
}

Backend Architecture

backend structure diagram

Database Schema

database schema

Installing Server Dependencies

From within the server directory:

$ npm install

Running Server-Side Tests

Before running any tests:

  1. Start the mysql server on your local machine
  2. Fill out the environment variables in env.json.example. JWT_SECRET can be any string.
  3. Rename the file .env.json.example to .env.json

To run unit tests, from within the server directory:

$ gulp test

To run server integration tests, from within server directory:

$ gulp server-integration-test

Contributing

See CONTRIBUTING.md for contribution guidelines.

You can’t perform that action at this time.