Skip to content
This repository has been archived by the owner on Sep 4, 2019. It is now read-only.

Reorganization of client-side repositories #137

Closed
elfey opened this issue Jan 25, 2017 · 3 comments · Fixed by feathersjs/feathers#697
Closed

Reorganization of client-side repositories #137

elfey opened this issue Jan 25, 2017 · 3 comments · Fixed by feathersjs/feathers#697

Comments

@elfey
Copy link

elfey commented Jan 25, 2017

Right now there's a bit of confusion for newcomers - most of us learn the server bit of feathers first, and then jump over to implementing it on the client.

However, the client has a completely different structure than the server and (in my opinion) is a little less organized than its relative (the server).

What if both the client and server had a similar structure across the board?

For example:

  • Client
    • feathers-client (core)
    • feathers-hooks-client
    • feathers-rest-client
    • feathers-socketio-client
    • feathers-authentication-client
  • Server
    • feathers (core)
    • feathers-hooks
    • feathers-rest
    • feathers-socketio
    • feathers-authentication

I hope you can see the pattern; for every server package, there's a client counterpart.

As for setting these up, it would work the same way on the client as it does on the server; you have your core feathers or feathers-client and you plug your feathers-* or feathers-*-client into each one, respectively.

Yes, this means more dependencies and repositories. I think though, that it will create a system that is more unified and easy to understand across the board because setup will be relatively similar on both frontend and backend.

That's good for individual developers and teams in general.

It means less confusion, more building.

@marshallswain
Copy link
Member

marshallswain commented Jan 25, 2017

Familiarity is definitely something worth striving for. We originally had everything at feathers-module/client, but decided to split out the client for feathers-authentication and create feathers-authentication-client, which has introduced the discrepancy.

feathers-hooks doesn't have its own client version, and it will be integrated into Feathers core sometime in the Buzzard release.

That will leave us in a state like this:

Client

import feathers from 'feathers/client';
import rest from 'feathers-rest/client';
import socketio from 'feathers-socketio/client';
import auth from 'feathers-authentication-client';

Server

const feathers = require('feathers');
const rest = require('feathers-rest');
const socketio = require('feathers-socketio');
const auth = require('feathers-authentication');

So the only difference on the client is the auth package. Maybe it's a better idea to bring it back into feathers-authentication/client and literally just export the feathers-authentication-client module.

@daffl
Copy link
Member

daffl commented Jan 25, 2017

This is a good suggestion. I wanted to create feathers-rest-client, feathers-socketio-client and feathers-primus-client for a while now (and probably should've created an issue for it so thank you for that 😄).

I am however suggesting to defer this to the next release (after Auk) for the following reasons:

Things would then look like this on the server:

const feathers = require('feathers');
const express = require('feathers-express');
const socketio = require('feathers-socketio');
const auth = require('feathers-authentication');

const app = feathers()
  // Turn `app` into an Express app
  .configure(express(options))
  // Set up REST HTTP handler for services using Express
  .configure(express.rest(options))
  // Old school Socketio
  .configure(socketio(options))
  // New auth
  .configure(auth());

And like this on the client:

const io = require('socket.io-client');
const feathers = require('feathers');
const socketio = require('feathers-socketio-client');
const auth = require('feathers-authentication-client');

const socket = io();
const app = feathers()
  .configure(socketio(socket))
  .configure(auth());

@elfey
Copy link
Author

elfey commented Jan 25, 2017

@marshallswain valid points, and thanks for reminding me about feathers-hooks being a part of core.

@daffl those are great ideas! Everything fits together nicely with that model of thinking.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants