Giter VIP home page Giter VIP logo

pixel-me's Introduction

Pixel me

This project is based on the wonderful Pixel art in React project by Javier Valencia and AWS Amplify.

With Pixel me, you can create, share, and collaborate on pixel art projects in real-time. You can then export the drawing or animation in either CSS, png, GIF, or spritesheet.

This project is built with GraphQL and the GraphQL Transform library.

There are a few main parts to this back end, but everything starts with the base GraphQL schema:

type Drawing @model
@auth(rules: [{allow: public, operations: [create, read, update]}])
@key(name: "byItemType", fields: ["itemType", "createdAt"], queryField: "itemsByType") {
  id: ID!
  clientId: ID!
  name: String!
  data: String
  public: Boolean
  itemType: String
  createdAt: String
  locked: Boolean
}

type Subscription {
  onUpdateByID(id: ID!): Drawing
    @aws_subscribe(mutations: ["updateDrawing"])
}

You can see there are a couple of things going on her here with directives and a custom subscription:

  • The @model directive will build out the DynamoDB table for the drawings
  • The @auth directive allows the creation and editing of types, but restricts the deletion of them
  • The @key directive gives us an easy way to run DynamoDB queries on the itemType field. This makes it easy to set custom access patterns on the itemType field. For instance, in the main view, we only query for Public drawings, but could also set this to anything that we'd like for additional data access patterns.
  • The custom subscription of onUpdateByID allows us to create a subscription for individual drawings by id

Deploy this app in your account

Using the Amplify CLI

  1. Clone the project and install the dependencies
$ git clone https://github.com/dabit3/pixel-me.git
$ cd pixel-me
$ npm install
  1. Initialize the Amplify app
$ amplify init
  1. Deploy the back end
$ amplify push
  1. Test locally
$ npm start

To run a build, run the build command

$ npm run build

Using the Amplify Console

amplifybutton

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.