. Happend. I made a mistake and I am straightening it up publicly. If you were following either my code or my posts carefully, you probably noticed I referred to environmental values a lot. From everywhere. That isn’t a good practice, in fact, it’s terrible, to follow that pattern. From different reasons, which I won’t be covering in this post.

What I will say, is that it doesn’t mean to not use them at all. In fact, I still am by myself. What I do is I wrap all my environmental variables into one config file. That way, you can still declare vals in your startup process, and have them together with all other useful configs at one file. One variable. One import.


That was quite a task, to get this going. I even had a serious problem with getting git commits separated from each other, so I ended up committing it all together.

As I mentioned earlier, I was arguing with myself on using either WebSockets which I am familiar with, or FireBase, which I got little idea of, but that’d shorten my development time, and would give me alot of performance advantages. Right. It would.

But finally, I decided to go with WebSockets — on top of Socket.IO. Decision was pretty simple, I’ve used WS before, and as I’m pretty limited if goes about time I can spend on this project — that was the easiest solution. …


Every webapp needs a database, right? I believe, there isn’t a single person, that’d try to argue over this statement. But what database, and how to structure — that is where the war begins.

For this project, I use MongoDB with mongoose on the top of it. Mongo is a noSQL, and no-relational database. Although it’s named non-relational, it doesn’t mean you can not have relations around you DB. You can. What you can’t do, is to merge them on the go, you can’t expect the DB to populate the results for you — you can make extra query, or you can specify the query, to populate results for you. But MongoDB, doesn’t do this for you. It definitely has some cons, but overall — DB is easier to scale and gives you (the developer) more freedom. …


Image for post
Image for post

A week ago I’ve spoken about basics of JWT; what are they, why they’re great alternative for cookies, and also, I briefly described different ways of authentication with their usage, as well as ways of matching identity, based on provided token.

Today I’d like to show you, one method on real life example. As Node developer, I’ll naturally demonstrate that on the Express project, although (I believe) similar pattern might be applied on majority of modern backend environments.

Introduction

As this post is about JWT implementation, I’ll assume you already have have at least basic project. Therefore, I should mention, that the file structure will probably differ. …


Image for post
Image for post

It took me waay longer than I expected, to start with the project. I’ll touch the surface of the reasons in another post, but what I’d like to simply report you the progress I’m at with the Byrd.

In my recent post, of #GetNoticed series, I said I’m gonna be starting out with front-end, because I’m not too sure about backend technology I’m planning to go with. Well, alot has changed, and since I’m not having much of free time, I made final decision; I’m going with the stack I’m the most familiar with - Node.js, MongoDB, React/Redux.

Although, as this project has to be websocket based (live chat), I’m not too sure about communication between the backend and the chat. In other words, I’ve recently heard about Firebase, I was recently building a simple app based on FB and you know what? That seems to be even easier than with WSS. I’m still arguing with myself on what I should base my chat on. …


Image for post
Image for post

Some of you may not be familiar with concept of tokens, so I’ll try to quickly explain those: Tokens overall is an abstract concept, of representing another object. For instance, you won the lottery, and you need to show the proof you actually are the lucky winner (congrats if you are!). What the proof would be? Most likely a voucher, right? Well, that’s the token in this case. You buy piece of software, and you got to input included serial code, while installation process. The serial would be the token — as the serial represents your ownership.

So just the same as on examples above, JWT is nothing else, but an object, representing your membership. In this case, token is in JSON format, so it’s easy to share some data with. You may ask why I choose JWT over cookies, and “how do you authenticate with them?”. Problem with Cookies is the fact, you can’t share them around. You got one device, that you’re logged onto on specific domain. You can’t share your session across whole domain, you need to log in twice, if your system is build on subdomains. Isn’t it painful? So tokens are the answer. They’re not strict about domain they’re used on — they might be, if that’s what you use them like. But don’t have to. …


Image for post
Image for post
Atom

Honestly, how often do you hear that question? Because I do hear it a lot, and it drives me nuts. What’s so important in tools you use? Why is your new, shiny shovel, made out of carbonated steel better, from my old, rusty one? It does it’s job, right? Why people focus on their gear so much, instead of what they can achieve with it? And that’s what I’m going to share my thoughts on today.

Editor, IDE, terminal, plugins. You can hear people arguing about their favorite… exactly, about what? I can’t call IDE an editor, because that’s going to start the storm, the storm of hate. And I won’t lie, I was involved in this kind of storms so many times. …


Okey, first of I shall say hi. That’s my first post on this platform, and I thought — why would I make a post saying I’m going to be posting, since I can post it at my first post… Aight, I think you got me now. This makes no sense. So I’ll simply say HI! I won’t say much about myself, you may look about me on linkedin or github. Or just continue reading my po… my stories. :)

What is Byrd, what is Get Noticed?

Byrd

The byrd is a free messaging app that lets you monitor and chat with visitors on your website. It’s a live support ticketing system. Sounds familiar? I believe so, you probably saw tawk.to’s widget all around the web. In fact, byrd’s functionality won’t differ at all (won’t because it’s not developed yet), the only difference between those two platform is the fact, the byrd will be an OpenSource project, built on top of MIT license, where everyone is welcome to contribute to or even start their own service. …

About

Patryk Cieszkowski

JavaScript Developer. Email me at me@polethedev.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store