While being self-employed and working from home can be a dream, it's also a road fraught with peril.

When you work in an office, there's more structure to your day. You follow a schedule like the one your coworkers follow; you take coffee breaks and a lunch break roughly when they do. And most importantly, since you're at work, you work.

For a self-employed person who works at home, it's not as simple. You may have deadlines to meet, but there are no set work hours. In theory, aside from meetings and phone calls with clients, you could work whatever hours you want. And that's a freedom that can be hard to handle.

It's possible, however, to have both flexibility and structure. You have to be disciplined and hold yourself accountable, but it can be done.

A man works at a laptop on a table.

Having a home office can create proper boundaries. Image source: Getty Images.

Set a baseline

Most people work for eight or so hours a day, between the hours of 8 a.m. and 6 p.m. Some, of course, work more, and some jobs have odd hours, but that's more or less the window when the majority of people who commute to work are in the office.

When you work from home, it's still important to have a routine. You need to set aside a period each day that's your baseline for "normal" hours. Maybe you work best early and have to drop kids off at school. That might mean planning to work from 6 to 8 a.m., take off from 8 to 9 a.m., then put in three more hours till noon. After that maybe you have an early lunch, and work from 12:30 to 3:30 p.m.

The actual hours don't matter. What's important is that you're establishing what your day is, so you can make substitutions. If, for example, you want to attend a yoga class one day a week that takes 90 minutes away from work hours, you know you "owe" yourself 90 minutes.

It sounds simple because it is. You're setting a standard for yourself that allows you to be as flexible as you want, because you've established a minimum. That means you can take a day off -- but you may have to make it up by working more hours, or putting in some time on the weekends.

Of course, you also have to build in room for flexibility in workflow. You may get a special project, or something extra that needs to be done and requires more time. When that happens, you can enjoy the extra money, bank some hours for future deviations from your schedule, or take time off.

It's all about you

"With great flexibility comes great responsibility." That's something Spiderman's uncle might say if Peter Parker chose to work from home.

As long as you keep your clients happy, you can more or less do whatever you want. That makes it too easy to justify taking a three-hour video game break -- because you can. Having set hours can help you avoid that pitfall. So can having a dedicated workspace.

Setting up an office -- or even a desk -- can also be a sign to your family as to when you're "home" (as a parent on duty), and when you're "at work." Of course, you're still there in an emergency -- that's one of the biggest perks. But you should also strive to make your work time as protected as if you were going into an office.