I made a Sharetribe Go API

https://github.com/jeremyevans6/sharetribe

At the moment, this should be titled “I am making a Sharetribe Go API”, but I’ll be bold since the current title will be more true in a short while.

Like when I implemented my marketplace, I’ll be around to help with this or anything for the month or so that I need to touch this and then dip out when development is done and marketing takes over again. I.e., I’m announcing a little early so that anyone interested can get a hold of me.

I used Grape API to build an API service within Sharetribe’s default RoR implementation, rather than a standalone API with access to the DB. As a result, I’m using all of the logic and validation of the Rails models and the API itself borrows from some exposed services (even a nifty “internal API”) to validate certain processes. This is as true to the real thing as it gets, at least in theory.

In practice, I’m not going to be losing sleep over making this a public feature. I’m not sure if the team will want an API added to Go, so I’ll provide my fork and leave it to them to decide if it should be pulled in. That said, I am making it easy to pull: I have a proper fork and I’m modifying virtually nothing in the default v10.1, just adding in. I’m not going to provide docs beyond what I require to understand my own coding here, though that’s usually pretty ample since I don’t rely on memory for these things.

As of now, I think I have most of the big ones done in complete CRUD fashion: Users, Transactions, Listings, etc. I’m building a React Native app for https://AtlasTalked.com, so I’m fleshing this out over the coming month. While this is in active development and unfinished, it’s at the stage where I’m making calls to it to develop my RN app. This will really flesh out the API in terms of performance and convenience. (For example, should I be returning emails from a unique endpoint (they have a seperate table) or including them with People? Is it faster and easier to build image URLs from the app or from the server? Etc.)

By the end of this process, it’ll be as complete as I need to do everything the site does. It’ll remain opinionated to my set-up, supporting only AWS for example. I’ll also skip the chat features which I’m outsourcing to a RocketChat server. (That’s going to be a 2-way implementation with their API, which might result in a seperate fork or I might keep it private. Given the lack of a plugin system, it’d be an awkward branch since there’d be no one to maintain cross-app compatibility.)

A final note, I’m not deviating from standard practice except in some cases of GET requests. I want to include my auth tokens in the headers, not exposed as queries, so some GET requests are turning into POSTs to be able to include the auth token. If this is terrible, please convince me. I don’t want just anyone to tax my fragile little RoR server, so I’m cautious in this way. (I tested the fresh instance of Sharetribe up to 750 concurrent users with my current server back when the DB was virtually empty, so I’m anticipating some scaling problems as I run my first ad campaigns. If anyone wants to explain to me what Kubernetes is, I’m listening :sweat_smile:)

Anyway, I was cautious about sharing this critical feature which could result in many more marketplaces springing up more easily, some of which will be competition. Between this, my fix for timezones, and my installation guide, there’s no excuse! I myself only learned RoR, RN, and all the rest of the stack from scratch to execute this project as a hobby and it wasn’t half as bad as it seemed. I’m hoping that you, dear reader, go on to validate my fears and force me to be a little better.