An online community for people to find and share household and other necessities during the Covid-19 crisis.
Ric Mershon
Kibbutz-19 is a central resource for the finding and offering help during the Covid-19 crisis.
API: https://kibbutz-19-api.herokuapp.com/graphql
Client: https://kibbutz-19-client.herokuapp.com (Alternatively at kibbutz-19.com but unsecured)
Kibbutz-19 is built on a MERN model with GraphQL
- MongoDB database with a relatonal model to associte items with members. See Database Schemas section below.
- Backend developed with Express and Node.js frameworks.
- API built on GraphQL for lightweight queries integrated with MongoDB via Mongoose.
- Database deployed to AWS using MongoDB Atlas.
- Deployed to Heroku.
- Responsive interface built with ReactJS and React Bootstrap.
- React Router with React Router Dom for easy interface navigation.
- GraphQL queries performed with Apollo Fetch.
- Chart.js for data charts.
Client repo and details can be found at https://github.com/ricmershon/kibbutz-16-client.
const memberSchema = new mongoose.Schema(
{
name: { type: String, required: true },
email: { type: String, required: true },
phone: { type: String, required: false },
password: { type: String, required: false },
contactMethod: {
type: String,
required: true,
enum: ['text', 'email', 'phone'],
default: 'text'
},
zipCode: { type: String, required: true }
}
)
const itemSchema = new mongoose.Schema(
{
helpType: {
type: String,
required: true,
enum: ['offering help', 'requesting help'],
default: 'requesting help'
},
tag: {
type: String,
required: true,
enum: [
'Baby Supplies',
'Business Support',
'Food',
'Supplies',
'Toiletries',
'Volunteer Work'
]
},
notes: String,
quantity: Number,
memberId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Member'
}
}
)
const userSchema = new mongoose.Schema({
name: {
type: String,
required: true,
trim: true
},
email: {
type: String,
required: true,
unique: true,
lowercase: true,
validate: value => {
if (!validator.isEmail(value)) {
throw new Error({error: 'Invalid Email address'})
}
}
},
password: {
type: String,
required: true,
minLength: 8
},
tokens: [{
token: {
type: String,
required: true
}
}]
})
GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data.
GraphQL resolvers are available for UserType and MemberType.
GraphQL queries perform read funtions.
Resolver | Description |
---|---|
user | returns a single user by ID |
users | returns all users |
member | returns a single member by ID |
members | returns all members |
All of the items associated with a member can be returned with the following sample GraphQL query:
query {
member(_id: "xxxx") {
name
email
items {
helpType
tag
notes
}
}
}
GraphQL mutations peform create, update and delete functions.
Resolver | Description |
---|---|
addMember | adds a member to the DB |
updateMember | updates a member's information |
deleteMember | delete's a member's record from the DB |
addItem | adds an item to the DB |
updateItem | updates an item's information |
deleteItem | delete's an item's record from the DB |
Mutation to create a member:
mutation {
addMember(name: "Peter Parker" email: "spiderman@theavengers.com" phone: "6786406926" zipCode: "41234") {
_id name email phone zipCode
}
}
- Express - backend framework for Node.js.
- MongoDB - a general purpose, document-based, distributed database. Database deployed to AWS (Amazon Web Services) using MongoDB Atlas.
- MongoDB Atlas- a Cloud-hosted MongoDB service on Amazon Web Services.* Mongoose - MongoDB object modeling for Node.js.
- dotenv - for loading environment variables from a .env file into process.env.
- ReactJS - a JavaScript library for building user interfaces.
- React Router - a collection of navigational components taht compose delaratively wiht a React application.
- React Bootstrap - for a responsive, mobile-first layout.
- GraphQL - an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data.
- Trello board - for project management.
- Chart.js - a free open-source JavaScript library for data visualization
- User authentication with JSON Web Tokens.
- React route for current Covid 19 News.
- Flexible data requests on Data page.
- Search capabilities.
- Sidebar information.